Skip to content

[PB-6343]: fix/keep modal open when the clicked element is re-rendered - #118

Merged
terrerox merged 2 commits into
masterfrom
fix/modal-click-outside-detached-target
Nov 6, 2026
Merged

terrerox merged 2 commits into
masterfrom
fix/modal-click-outside-detached-target

Conversation

@terrerox

@terrerox terrerox commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Fix the Modal closing when clicking an element inside it that is replaced on mousedown (e.g. the eye icon of a password Input). The clicked element was already detached when the outside-click check ran, so contains(event.target) returned false. The check now uses event.composedPath(), which still includes the modal.

  • Clicks inside/outside, preventClosing, Escape and stacked modals behave as before.
  • Added tests for the password eye icon inside a Modal and for closing on outside click.
  • Updated the package version.

@terrerox
terrerox requested a review from CandelR November 6, 2026 02:24
@terrerox
terrerox merged commit ca0b90d into master Nov 6, 2026
1 check passed
@terrerox
terrerox deleted the fix/modal-click-outside-detached-target branch November 6, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants