Skip to content

Conversation

@ncamera
Copy link
Collaborator

@ncamera ncamera commented Oct 15, 2025

Changes we propose in this PR

  • Use the viewport size, instead of the whole document size to properly position the popover.
    When the document has scrollbars, the ch-popover was not positioned correctly because the entire document size was used instead of the viewport size.

  • Properly calculate the ch-popover's max size.
    We were always using the max size of the CSS custom vars if they were defined.

  • Add support to re-position the ch-popover when the browser's window is resized.

  • Add support to close the popover if it is no longer visible.

  • Add support to know the reason of the popoverClosed event.
    The reason property of the event provides more information about the cause of the closing:

    • "click-outside": The popover is being closed because the user clicked outside the popover when using closeOnClickOutside === true and mode === "manual".

    • "escape-key": The popover is being closed because the user pressed the "Escape" key when using closeOnClickOutside === true and mode === "manual".

    • "popover-no-longer-visible": The popover is being closed because it is no longer visible.

    • "toggle": The popover is being closed by the native toggle behavior of popover. It can be produced by the user clicking the actionElement, pressing the "Enter" or "Space" keys on the actionElement, pressing the "Escape" key or other. Used when mode === "auto".

  • Avoid emitting duplicated popoverClosed event.
    This fixes emitting the duplicated event in the following scenarios:

    • The "Escape" key is pressed in mode === "manual".

    • The user clicks outside the popover in mode === "manual".

    • The show property is changed to false externally.

    • The user scrolls the window and the popover is no longer visible.

@ncamera ncamera added fix Bug fix pull request target: minor This PR is targeted for the next minor release accessibility Fix or feature related to accessibility performance Work related to imporving the performance in the library refactoring Issue that involves refactoring or code-cleanup labels Oct 15, 2025
@ncamera ncamera changed the title [ch-popover] Fix issues related with the positioning of the popover. [ch-popover] Fix issues related with the positioning of the popover Oct 15, 2025
@netlify
Copy link

netlify bot commented Oct 15, 2025

Deploy Preview for gx-chameleon ready!

Name Link
🔨 Latest commit 41bd334
🔍 Latest deploy log https://app.netlify.com/projects/gx-chameleon/deploys/68efc1a95a1da700080411a9
😎 Deploy Preview https://deploy-preview-562--gx-chameleon.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@ncamera ncamera added the feature Feature implementation pull request label Oct 15, 2025
@ncamera ncamera merged commit 270b5b9 into main Oct 15, 2025
8 checks passed
@ncamera ncamera deleted the fix/popover-positioning-with-scrolls-in-html branch October 15, 2025 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accessibility Fix or feature related to accessibility feature Feature implementation pull request fix Bug fix pull request performance Work related to imporving the performance in the library refactoring Issue that involves refactoring or code-cleanup target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants