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(card): Update full-screen focus trap logic #701

Merged
merged 2 commits into from
Jul 19, 2023
Merged

Conversation

gadenbuie
Copy link
Member

@gadenbuie gadenbuie commented Jul 19, 2023

Changes from #662 have affected the visibility and tab focus order of the full screen enter button. This PR updates the focus trap logic in two ways:

  • Because the full screen enter button retains focus when entering full screen mode, we now detect this case and move focus to the parent card when making the card full screen. We also do this step a little later (after adjusting the full screen attribute and setting classes on the document body).

  • The full screen enter button is included in the list of focusable elements, even when the card is in full screen. Helpfully, it's always the last element. We remove it from our list of focusable elements so that we skip it when the user reaches the end of the card.

This issue was uncovered by 313-bslib-card-tab-focus.

For rstudio/shinycoreci#195

* Full screen enter button retains focus when entering full screen mode, in which case we move focus to the card. We also do this a little later now.
* The full screen enter button is included in the list of focusable elements, but always as the last element. We remove it from our list of focusable elements so that we skip it.
@gadenbuie gadenbuie merged commit 1926c23 into main Jul 19, 2023
@gadenbuie gadenbuie deleted the card/fix-focus-trap branch July 19, 2023 21:39
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.

Update 313-bslib-card-tab-focus to reflect bslib tooltip update
2 participants