Skip to content

Commit

Permalink
Improve accessible name of version dropdown in docs navbar (twbs#36495)
Browse files Browse the repository at this point in the history
- add `aria-hidden="true"` to the "Bootstrap" text that is hidden on large screens
- add separate visually-hidden "Bootstrap", which will be part of the accessible name regardless of whether the other string is visible or not (on large screen)
- extra visually-hidden text to give some context - that the dropdown is about switching versions
- remove the redundant id/aria-labelledby for the dropdown
  • Loading branch information
patrickhlauke authored and mwszekely committed Jun 8, 2022
1 parent 5fc73a0 commit 97dd50f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions site/layouts/partials/docs-versions.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
{{- end }}

<li class="nav-item dropdown">
<button class="btn btn-link nav-link py-2 px-0 px-lg-2 dropdown-toggle" id="bd-versions" data-bs-toggle="dropdown" aria-expanded="false" data-bs-display="static">
<span class="d-lg-none">Bootstrap</span> v{{ .Site.Params.docs_version }}
<button class="btn btn-link nav-link py-2 px-0 px-lg-2 dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false" data-bs-display="static">
<span class="d-lg-none" aria-hidden="true">Bootstrap</span><span class="visually-hidden">Bootstrap&nbsp;</span> v{{ .Site.Params.docs_version }} <span class="visually-hidden">(switch to other versions)</span>
</button>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="bd-versions">
<ul class="dropdown-menu dropdown-menu-end">
<li><h6 class="dropdown-header">v5 releases</h6></li>
<li>
<a class="dropdown-item current" aria-current="true" href="{{ if .IsHome }}/{{ else }}/docs/{{ .Site.Params.docs_version }}/{{ $versions_link }}{{ end }}">
Expand Down

0 comments on commit 97dd50f

Please sign in to comment.