]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
v4: Improve accessible name of version dropdown in docs navbar (#36504)
authorPatrick H. Lauke <redux@splintered.co.uk>
Sun, 5 Jun 2022 09:33:18 +0000 (10:33 +0100)
committerGitHub <noreply@github.com>
Sun, 5 Jun 2022 09:33:18 +0000 (10:33 +0100)
- add `sr-only` "Bootstrap", which will be part of the accessible name
- extra `sr-only` text to give some context - that the dropdown is about switching versions
- remove the redundant id/aria-labelledby for the dropdown
- change the control from `<a>` to `<button>`

site/layouts/partials/docs-navbar.html

index 33ec402b98600682d477caf05db42647b563c49b..363814ceb6f976c6bfc7163cb7f8255ad84803ba 100644 (file)
 
   <ul class="navbar-nav ml-md-auto">
     <li class="nav-item dropdown">
-      <a class="nav-item nav-link dropdown-toggle mr-md-2" href="#" id="bd-versions" data-toggle="dropdown" aria-expanded="false">
-        v{{ .Site.Params.docs_version }}
-      </a>
-      <div class="dropdown-menu dropdown-menu-md-right" aria-labelledby="bd-versions">
+      <button class="btn nav-link dropdown-toggle mr-md-2" data-toggle="dropdown" aria-expanded="false">
+        <span class="sr-only">Bootstrap&nbsp;</span> v{{ .Site.Params.docs_version }} <span class="sr-only">(switch to other versions)</span>
+      </button>
+      <div class="dropdown-menu dropdown-menu-md-right">
         <a class="dropdown-item active" href="/docs/{{ .Site.Params.docs_version }}/">Latest ({{ .Site.Params.docs_version }}.x)</a>
         <div class="dropdown-divider"></div>
         <a class="dropdown-item" href="https://getbootstrap.com/docs/5.1/">5.1.x</a>