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

Fix modal hidden focusable bug #280

Merged
merged 16 commits into from Aug 2, 2020
Merged

Fix modal hidden focusable bug #280

merged 16 commits into from Aug 2, 2020

Conversation

sebnitu
Copy link
Owner

@sebnitu sebnitu commented Aug 2, 2020

Problem

There's a bug that allows tab to escape the modal when the first or last focusable elements are hidden via CSS.

Solution

This PR extracts the focusable array build into it's own method and includes a focus test. This also created the need to fire open and close sequentially so there was a refactor introducing promises so that an open call only happens after a close is complete. The impacts how opening modals from inside other modals works. Because of this refactor, it removes the need for callbacks since you can now wait for the promises to resolve. Lastly, a "working" check is done on click so that it's no longer possible to trigger a new modal open if one is in the middle of transitioning.

@sebnitu sebnitu added the PR: fix label Aug 2, 2020
@sebnitu sebnitu merged commit da0143e into master Aug 2, 2020
@sebnitu sebnitu deleted the fix-modal-bugs branch August 2, 2020 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant