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

feature/useFocusTrap: Support focusable tab cycles in Modal (Update of PR #3075) #3133

Merged

Conversation

Pragadesh-45
Copy link
Contributor

@Pragadesh-45 Pragadesh-45 commented Sep 18, 2024

fixes: #2076

Description

This PR updates #3075 to improve focus management within the modal. It ensures that focus is restricted to elements within the modal when it contains at least one focusable element. The approach follows guidance from Stack Overflow to confine focus to internal elements only.

This is the Reference to this specific implementation: Keep tabbing within modal pane only

Key Changes:

  • Added focus trapping within the modal to restrict focus to internal elements.
  • Adjusted tabindex to hide non-focusable elements outside the modal.
  • Set initial focus to the first focusable element within the modal.
  • Implemented focus looping between the first and last focusable elements.
  • Restored original tabindex values and optimized the code for clarity and performance.

Contribution Checklist:

  • The pull request addresses only one issue or adds one feature.
  • The pull request does not introduce any breaking changes.
  • I have read the contribution guidelines.
  • The issue has been created and linked to this pull request.

@helloanoop helloanoop merged commit 563683b into usebruno:main Sep 20, 2024
2 checks passed
@helloanoop
Copy link
Contributor

Thank you @Pragadesh-45 !

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.

2 participants