添加到残疾人div的组件并非全部继承残疾人属性

发布于 2025-02-03 01:26:18 字数 956 浏览 3 评论 0原文

对于我们的UI的一部分,主要DIV被禁用,然后根据加载的数据添加更多组件。但是,如果在添加其他组件之前禁用主DIV,则仅添加的一些其他组件具有禁用的属性集。

已经尝试使用Java 17的Vaadin 23.0.10和

        VerticalLayout vlMain = new VerticalLayout();
        vlMain.setSizeFull();
        HorizontalLayout hlOne = new HorizontalLayout(FontAwesome.Solid.BUG.create(), new Button("Testing"));
        HorizontalLayout hlTwo = new HorizontalLayout();
        hlOne.setEnabled(false);
        hlTwo.setEnabled(false);
        Button add = new Button("Add");
        add.addClickListener(buttonClickEvent -> {
            if(buttonClickEvent.isFromClient())
            {
                hlTwo.add(FontAwesome.Solid.BUG.create());
                hlTwo.add(new Button("Testing"));
            }
        });
        vlMain.add(hlOne, hlTwo, add);

23.1.0rc1 单击按钮添加其他组件,但是图标不会继承残疾人属性,但该按钮可以。再次调用hltwo.setEnabled(false),然后正确设置所有内容。可以使用浏览器检查器对此进行验证。

尽管有解决方法,但很高兴知道预期的行为应该是什么。

谢谢。

For part of our UI, the main div is disabled and then more components are added based on the data loaded. However, if the main div is disabled before adding the additional components, then only some of the additional components added have the disabled attribute set.

Have tried Vaadin 23.0.10 and 23.1.0rc1 with Java 17.

Example code:

        VerticalLayout vlMain = new VerticalLayout();
        vlMain.setSizeFull();
        HorizontalLayout hlOne = new HorizontalLayout(FontAwesome.Solid.BUG.create(), new Button("Testing"));
        HorizontalLayout hlTwo = new HorizontalLayout();
        hlOne.setEnabled(false);
        hlTwo.setEnabled(false);
        Button add = new Button("Add");
        add.addClickListener(buttonClickEvent -> {
            if(buttonClickEvent.isFromClient())
            {
                hlTwo.add(FontAwesome.Solid.BUG.create());
                hlTwo.add(new Button("Testing"));
            }
        });
        vlMain.add(hlOne, hlTwo, add);

When the above is run, hlOne contains 2 disabled controls.
Clicking the button adds the additional components, however the icon doesn't inherit the disabled attribute but the button does. Calling hlTwo.setEnabled(false) again then sets everything correctly. This can be verified using the browser inspector.

While there is the workaround, it would be good to know what the expected behaviour should be.

Thanks.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文