Skip to content

fix: add inert attribute to background content when popup is shown#34

Merged
rubenhensen merged 7 commits into
mainfrom
fix/issue-22
Apr 3, 2026
Merged

fix: add inert attribute to background content when popup is shown#34
rubenhensen merged 7 commits into
mainfrom
fix/issue-22

Conversation

@rubenhensen

Copy link
Copy Markdown
Contributor

Summary

  • Moves the validation error modal container to document.body via a portal $effect, ensuring it sits outside <main> and <header> in the DOM
  • Adds inert attribute to <main> and <header> when the error popup is shown, trapping keyboard focus inside the popup
  • Removes inert attribute from background elements when the popup is closed

Closes #22

When the validation error popup is displayed, the modal container is
moved to document.body via a portal effect so that the inert attribute
can safely be applied to <main> and <header>. This prevents keyboard
focus from reaching background content while the popup is open.
Replace manual inert attribute management + DOM portal approach with a
native <dialog> element using showModal(). The browser's top-layer
mechanism handles focus trapping and background inertness natively,
fixing keyboard navigation leaking to background elements.
@rubenhensen rubenhensen merged commit 062cdc3 into main Apr 3, 2026
3 checks passed
@rubenhensen rubenhensen deleted the fix/issue-22 branch April 3, 2026 12:41
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.

Error popup: add inert attribute to background content

1 participant