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

feat(Modal): keep focus inside opened modal, return focus to last element #2434

Conversation

YossiSaadi
Copy link
Contributor

Focus lock

@YossiSaadi YossiSaadi marked this pull request as ready for review September 24, 2024 07:43
@YossiSaadi YossiSaadi requested a review from a team as a code owner September 24, 2024 07:43
/>
{children}
</div>
<FocusLock returnFocus>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to use it also in Dialogs in the future

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, we need to maybe implement it in all the system modals and old modal, and therefore all the locks would use the same lib and can live in harmony, until all would migrate to the new modal

@@ -129,6 +129,71 @@ describe("Modal", () => {
expect(mockOnClose).toHaveBeenCalled();
});

it("traps focus inside the modal when opened", () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice tests!!

@YossiSaadi YossiSaadi force-pushed the feat/yossi/modal-a11y-lock-scroll-of-parts-other-than-modal-when-opened-7391259531 branch 2 times, most recently from 6306ce0 to 26df930 Compare September 25, 2024 07:43
Base automatically changed from feat/yossi/modal-a11y-lock-scroll-of-parts-other-than-modal-when-opened-7391259531 to feat/yossi/new-modal-building-blocks-7359960492 September 25, 2024 07:46
An error occurred while trying to automatically change base from feat/yossi/modal-a11y-lock-scroll-of-parts-other-than-modal-when-opened-7391259531 to feat/yossi/new-modal-building-blocks-7359960492 September 25, 2024 07:46
@YossiSaadi YossiSaadi force-pushed the feat/yossi/modal-a11y-keep-focus-only-inside-modal-7360933300 branch from 16dc805 to c56818d Compare September 25, 2024 07:58
@YossiSaadi YossiSaadi merged commit 5f66d89 into feat/yossi/new-modal-building-blocks-7359960492 Sep 26, 2024
9 of 10 checks passed
@YossiSaadi YossiSaadi deleted the feat/yossi/modal-a11y-keep-focus-only-inside-modal-7360933300 branch September 26, 2024 06:06
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