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

Remove autofocus on theme switch when page is loaded #37836

Merged
merged 1 commit into from
Jan 8, 2023

Conversation

julien-deramond
Copy link
Member

@julien-deramond julien-deramond commented Jan 8, 2023

Description

From #37780, when our docs website is loaded, the theme switch gets automatically the focus which causes an issue of a11y since we can't go directly on the skip links.

I suppose that this modification was rather made to only give back the focus to the dropdown when a change is made and not during the init phase.

In order to understand what I'm saying, simply load https://twbs-bootstrap.netlify.app/. The focus (blue outline difficult to see) is automatically on the dropdown, then press Tab; "New in v5.3" will be focused instead of the skip links.

I tried to isolate the init phase in the script to force the focus only after. Please double-check that the a11y modifications made in the previous PR are still OK but it seems so.

Type of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have read the contributing guidelines
  • My code follows the code style of the project (using npm run lint)
  • My change introduces changes to the documentation
  • I have updated the documentation accordingly
  • All new and existing tests passed

Live previews

@julien-deramond julien-deramond force-pushed the main-jd-fix-autofocus-on-theme-switch branch from 5f27dbd to 8c29620 Compare January 8, 2023 15:05
@julien-deramond julien-deramond marked this pull request as ready for review January 8, 2023 15:07
@julien-deramond julien-deramond requested a review from a team as a code owner January 8, 2023 15:07
@mdo
Copy link
Member

mdo commented Jan 8, 2023

/cc @patrickhlauke since I think he recently made some changes here

@patrickhlauke
Copy link
Member

oops. my bad @julien-deramond ... missed the fact this triggers on page load already. this PR fixes the issue nicely.

@mdo mdo merged commit 3990571 into main Jan 8, 2023
@mdo mdo deleted the main-jd-fix-autofocus-on-theme-switch branch January 8, 2023 23:39
krzysdz added a commit to krzysdz/inz that referenced this pull request Jan 16, 2023
This commit mirrors twbs/bootstrap#37780 with ~~a small fix~~ a fix from twbs/bootstrap#37836 and adds the missing checkmark icon to the theme dropdown.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants