Skip to content

Popover listeners don't work inside a modal dialog #8031

@ziza

Description

@ziza

Description of the bug

When we place a popover inside a modal dialog, the addOpenedChangeListener does not work, and if I place a CheckboxGroup inside the popover, the CheckboxGroup listeners do not work either.

Expected behavior

Listeners must be triggered correctly within modal dialogs.

Minimal reproducible example

CheckboxGroup<String> group = new CheckboxGroup<>();
group.addThemeVariants(CheckboxGroupVariant.LUMO_VERTICAL);
group.setItems(List.of("Test 1", "Test 2", "Test 3", "Test 4", "Test 5", "Test 6"));
group.addValueChangeListener(e -> { //Not working when inside a modal dialog
    for (String s : e.getValue())
        System.out.println(s);
});

Button button = new Button();
Popover popover = new Popover(group);
popover.addOpenedChangeListener(e -> {//Not working when inside a modal dialog
    System.out.println("Opened: " + e.isOpened());
});
popover.setTarget(button);

final Dialog dialog = new Dialog();
dialog.setWidth("320px");
dialog.setHeight("320px");
dialog.setModal(true); //if you disable this option it works
dialog.setCloseOnOutsideClick(true);
dialog.add(button);
dialog.open();

Versions

  • Vaadin / Flow version: 24.8.6
  • Java version: 21.0.7
  • OS version: Windows 11
  • Browser version (if applicable): Chrome 139.0.7258.139
  • Application Server (if applicable): Embedded tomcat from springboot
  • IDE (if applicable):IntelliJ

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions