Skip to content
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

Popover outside click closes parent dialog #7481

Closed
tomivirkki opened this issue Jun 7, 2024 · 3 comments · Fixed by #7556
Closed

Popover outside click closes parent dialog #7481

tomivirkki opened this issue Jun 7, 2024 · 3 comments · Fixed by #7556
Assignees

Comments

@tomivirkki
Copy link
Member

tomivirkki commented Jun 7, 2024

Description

Clicking outside of a modeless opened popover that's inside an open dialog also causes the dialog to close

Kapture.2024-06-07.at.14.04.10.mp4

Note: Clicking outside a modal popover doesn't close the parent dialog so this may be the expected behavior for modeless popovers. Needs discussion.

Expected outcome

Only the popover overlay should close

Minimal reproducible example

<vaadin-dialog></vaadin-dialog>

<script type="module">
  import '@vaadin/popover';
  import '@vaadin/dialog';

  const dialog = document.querySelector('vaadin-dialog');
  dialog.renderer = (root) => {
    root.innerHTML = `
      <button id="target">Open popover</button>
      <vaadin-popover for="target"></vaadin-popover>
    `;
    root.querySelector('vaadin-popover').renderer = (root) => {
      root.textContent = 'popover content';
    };
  };

  dialog.opened = true;
</script>

Steps to reproduce

  • Open the popover by clicking the button
  • Click outside the dialog

Environment

Vaadin version(s): 24.5

Browsers

Issue is not browser related

@web-padawan
Copy link
Member

Related to #7466

@tomivirkki
Copy link
Member Author

We discussed this internally and it might make the most sense to have an outside click only close the topmost overlay which is closable with an outside click (same with an ESC).

If a dialog (or another popover) contains an opened modeless popover that doesn't close with an outside click, then a click outside the parent overlay could close it (this would result in both overlays getting closed).

@tomivirkki
Copy link
Member Author

It might not be easy to make randomly stacked popovers and dialogs work nicely together because Popover currently uses its own global click listener implementation. Perhaps we could make overlay accept a property that makes it support modeless+outside click listener the way popover needs, to have the overlay stacking logic in one place only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants