英文:
How to change/override property pointer-event in a Vaadin dialog
问题
我们有一个第三方应用程序(仅有启动按钮),它始终显示在我们的应用程序的最顶层。它工作得很好,除了模态对话框会阻止交互。经过一些调查,我们注意到样式 "pointer-events:none;" 导致了这个问题。vaadin-dialog-overlay 继承了这个属性。
我们尝试通过扩展对话框来解决这个问题,在对话框创建时将 pointer-events 设置为 auto
UI.getCurrent().getElement().getStyle().set("pointer-events", "auto");
并在对话框关闭时删除 pointer-events。
UI.getCurrent().getElement().getStyle().remove("pointer-events");
不幸的是,这个解决方案只在某些情况下有效。我们还尝试在 openChangeListener 中更改属性。
请帮忙。我们使用的是 Vaadin 14。
提前感谢您。
英文:
We have a third party application (launch button only) which is always shown on top most in our application. It works fine except for modal dialogs which prevent interaction. After some digging, we noticed the style "pointer-events:none;" causes the issue. vaadin-dialog-overlay inherits the property.
We tried to resolve the issue by extending dialog, set pointer-events to auto when dialog is created
UI.getCurrent().getElement().getStyle().set("pointer-events", "auto");
and remove pointer-events when dialog is closed.
UI.getCurrent().getElement().getStyle().remove("pointer-events");
Unfortunately this solution works only in some cases. We also tried to change the property in openChangeListener.
Please help. We are using Vaadin 14.
Thanks you in advance.
答案1
得分: 1
你可以将其设置为非模态:
Dialog dialog = new Dialog();
dialog.setModal(false);
更多信息请参考:https://vaadin.com/docs/latest/components/dialog/#modality
英文:
You can make it a non-modal:
Dialog dialog = new Dialog();
dialog.setModal(false);
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论