]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Improve accessible name of version dropdown in docs navbar (#36495)
authorPatrick H. Lauke <redux@splintered.co.uk>
Sun, 5 Jun 2022 08:59:41 +0000 (09:59 +0100)
committerGitHub <noreply@github.com>
Sun, 5 Jun 2022 08:59:41 +0000 (09:59 +0100)
- 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

site/layouts/partials/docs-versions.html

index 54cf3a2e2a7e4e07026ce29dc7f1302a431c4009..2ebf4416d3e3f9f4c6be6b9c95723b007cbcf8a3 100644 (file)
 {{- 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 }}">