Skip to content

Modal: fix issue with click outside to dismiss #2846

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

shleewhite
Copy link
Contributor

@shleewhite shleewhite commented Apr 29, 2025

📌 Summary

If merged this PR would update Modal to not use ember-focus-trap to dismiss the Modal on click outside and instead use our own click event.

It also fixes an issue where the scroll bar would get added back if try to close the modal when isDismissDisabled=true.

🛠️ Detailed description

This is necessary because the ember-focus-trap's clickOutSideDeactivates only ever runs once. If a consumer conditionally disables the ability to dismiss the modal, the user may not be able to click outside to deactivate it.

Steps to reproduce:

  1. Navigate to: https://hds-showcase.vercel.app/components/modal#demo
  2. Click "Open non-dismissable modal"
  3. Click outside the modal after it opens, notice it doesn't close and you are able to scroll the page behind the modal.
  4. Click "reset isDismissDisabled"
  5. Click outside the modal, notice it doesnt close.
  6. Click "confirm"/"Cancel"/"close", notice the modal does close.

🔗 External links

Jira ticket: HDS-3972


👀 Component checklist

💬 Please consider using conventional comments when reviewing this PR.

Copy link

vercel bot commented Apr 29, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
hds-showcase ✅ Ready (Inspect) Visit Preview Apr 29, 2025 6:59pm
hds-website ✅ Ready (Inspect) Visit Preview Apr 29, 2025 6:59pm

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

Successfully merging this pull request may close these issues.

2 participants