Skip to content

MPR, add code example of how to use legacy component with modal dialog #4405

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: latest
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions articles/tools/mpr/configuration/limitations.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,29 @@ Z-indexes of the modern Vaadin Design System aren't aligned with legacy. Compone

For example, using such Vaadin 7 and 8 components with LegacyWrapper in Dialog may not work as expected.

== Legacy Components & Modal Dialogs

Legacy component events don't work unless you disable server-side modality of the Dialog component. You can do that after the Dialog component has been opened.

[source,java]
----
Dialog dialog = new Dialog();
dialog.setHeaderTitle("Dialog");
dialog.add(new Label("Hello"));
// Using legacy button
LegacyWrapper wrapper = new LegacyWrapper(new Button("Close", e -> {
dialog.close();
}));
dialog.addOpenedChangeListener(e -> {
if (e.isOpened()) {
UI.getCurrent().setChildComponentModal(dialog, false);
}
});
Comment on lines +139 to +143
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be just dialog.setModal(false)?

dialog.getFooter().add(wrapper);
// Dialog needs to be added to layout
add(dialog);
----

<<../overview#,<Back to Overview>>


Expand Down