如何在Vaadin对话框中更改/覆盖属性 pointer-event。

huangapple go评论59阅读模式
英文:

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.

如何在Vaadin对话框中更改/覆盖属性 pointer-event。

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);

https://vaadin.com/docs/latest/components/dialog/#modality

huangapple
  • 本文由 发表于 2023年6月5日 20:10:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/76406281.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定