双击事件未在iOS / Safari上使用vaadin网格发射

发布于 2025-02-09 11:50:40 字数 1256 浏览 1 评论 0原文

我正在使用Vaadin 23.1.0创建一个响应式的Web应用程序,并遇到了一个问题,即双击事件未在iPhone上使用Safari发射。在其他平台上从来没有任何问题。

以下代码说明了问题。按钮单击iOS上的工作,DoubleClick没有。

@PageTitle("IosTestView")
@Route(value = "IosTestView", layout = MainLayout.class)
@PermitAll
@Log4j2
public class IosTestView extends VerticalLayout {

    public IosTestView() {
        H2 h2 = new H2("IOS Test View");
        add(h2);
        List<String> testData = Arrays.asList("One", "Two", "Three", "Four", "Five");
        Grid<String> testGrid = new Grid<>();
        testGrid.addColumn(new ComponentRenderer<>(a -> new Button("Go", b -> show(a))));
        testGrid.addColumn(a -> a);
        testGrid.addItemDoubleClickListener(a -> show(a.getItem()));
        testGrid.setItems(testData);
        add(testGrid);
    }

    private void show(String msg) {
        Notification notification = new Notification();
        notification.setPosition(Notification.Position.MIDDLE);
        notification.setText("Item : " + msg);
        notification.setDuration(5000);
        notification.open();
    }
}

不知道是否有一个简单的修复程序...但是添加一个额外的按钮而不是使用双击不是我喜欢的选项...

上下文菜单确实在iOS上可以使用,但是我没有可能获取所选项目 - 它始终是null ...似乎是同一问题...

任何帮助真的欢迎

:-) 斯特凡

I am creating a responsive web app using vaadin 23.1.0 and got a problem that the double click event is not fired on an Iphone with Safari. Never had any issues with that on other platforms.

The following code illustrates the problem. Button click works on IOS, doubleclick doesn't.

@PageTitle("IosTestView")
@Route(value = "IosTestView", layout = MainLayout.class)
@PermitAll
@Log4j2
public class IosTestView extends VerticalLayout {

    public IosTestView() {
        H2 h2 = new H2("IOS Test View");
        add(h2);
        List<String> testData = Arrays.asList("One", "Two", "Three", "Four", "Five");
        Grid<String> testGrid = new Grid<>();
        testGrid.addColumn(new ComponentRenderer<>(a -> new Button("Go", b -> show(a))));
        testGrid.addColumn(a -> a);
        testGrid.addItemDoubleClickListener(a -> show(a.getItem()));
        testGrid.setItems(testData);
        add(testGrid);
    }

    private void show(String msg) {
        Notification notification = new Notification();
        notification.setPosition(Notification.Position.MIDDLE);
        notification.setText("Item : " + msg);
        notification.setDuration(5000);
        notification.open();
    }
}

No idea if there is an easy fix for this... but adding an extra button instead of using double click is not my favorite option...

Context Menu does work on IOS but I have no possibility to get the selected item - it's always null... seems to be the same issue...

Any help really welcome :-)

Regards
Stefan

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

や莫失莫忘 2025-02-16 11:50:42

听起来像是您描述的另一个问题的根本原因。另一个问题在23.1.1- https://github.com/vaadin/流程/问题/3296

请更新到当前版本,以查看是否也解决了您的问题。

Sounds like the same root cause as the other issue you described. The other issue was fixed in 23.1.1 - https://github.com/vaadin/flow-components/issues/3296.

Please update to the current version to see if this fixes your problem as well.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文