diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-07-04 06:08:08 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-04 06:08:08 +0200 |
| commit | 47456ad4ef7c011cef4274439df555cc7b3c2911 (patch) | |
| tree | a795212617d517516817c5a943a1bee19d0d03b8 /src/librustdoc/html/static/js/source-script.js | |
| parent | 7352c7b6cda42e7aaf8f13060ee12bd0cd15c99a (diff) | |
| parent | 9938d56d8cefb09584f6b75136ecb22a3d3dd759 (diff) | |
| download | rust-47456ad4ef7c011cef4274439df555cc7b3c2911.tar.gz rust-47456ad4ef7c011cef4274439df555cc7b3c2911.zip | |
Rollup merge of #98774 - notriddle:notriddle/source-code-sidebar-button, r=GuillaumeGomez
rustdoc: make source sidebar toggle a real button This fixes tab focus, so that you can open and close the sidebar from keyboard. This should cause no visible change in appearance at all. The only way you'd know anything different is if you tried to use keyboard controls to open the source code file navigation sidebar. Separated out from #98772
Diffstat (limited to 'src/librustdoc/html/static/js/source-script.js')
| -rw-r--r-- | src/librustdoc/html/static/js/source-script.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/librustdoc/html/static/js/source-script.js b/src/librustdoc/html/static/js/source-script.js index 9173e93e7c8..45e70c9a7c7 100644 --- a/src/librustdoc/html/static/js/source-script.js +++ b/src/librustdoc/html/static/js/source-script.js @@ -57,7 +57,7 @@ function createDirEntry(elem, parent, fullPath, hasFoundFile) { } function toggleSidebar() { - const child = this.children[0]; + const child = this.parentNode.children[0]; if (child.innerText === ">") { if (window.innerWidth < 701) { // This is to keep the scroll position on mobile. @@ -86,15 +86,15 @@ function toggleSidebar() { function createSidebarToggle() { const sidebarToggle = document.createElement("div"); sidebarToggle.id = "sidebar-toggle"; - sidebarToggle.onclick = toggleSidebar; - const inner = document.createElement("div"); + const inner = document.createElement("button"); if (getCurrentValue("source-sidebar-show") === "true") { inner.innerText = "<"; } else { inner.innerText = ">"; } + inner.onclick = toggleSidebar; sidebarToggle.appendChild(inner); return sidebarToggle; |
