Skip to content

Conversation

brahmlower
Copy link

This change resolves #990 by removing the blue outline around the menu bar buttons. The following gif demonstrates the resulting behavior.

mdbook-990-fix

@ehuss
Copy link
Contributor

ehuss commented Oct 5, 2019

Thanks! I imagine that is annoying in chrome. It's unfortunate that chrome behaves that way.

I'm concerned about hiding the outline outright, since it makes it more difficult to interact with the keyboard, and is a general accessibility concern.

What do you think about an approach like this? I've been fiddling on a few different browsers, and it seems to be somewhat ok.

diff --git a/src/theme/book.js b/src/theme/book.js
index ca73ee14d..f5ea8da5f 100644
--- a/src/theme/book.js
+++ b/src/theme/book.js
@@ -373,6 +373,7 @@ function playpen_text(playpen) {
     themeToggleButton.addEventListener('click', function () {
         if (themePopup.style.display === 'block') {
             hideThemes();
+            this.blur();
         } else {
             showThemes();
         }
@@ -394,6 +395,7 @@ function playpen_text(playpen) {
     document.addEventListener('click', function(e) {
         if (themePopup.style.display === 'block' && !themeToggleButton.contains(e.target) && !themePopup.contains(e.target)) {
             hideThemes();
+            themeToggleButton.blur();
         }
     });

@@ -477,6 +479,10 @@ function playpen_text(playpen) {
         }
     });

+    sidebarToggleButton.addEventListener('mouseup', function (e) {
+        this.blur();
+    });
+
     sidebarResizeHandle.addEventListener('mousedown', initResize, false);

     function initResize(e) {
diff --git a/src/theme/searcher/searcher.js b/src/theme/searcher/searcher.js
index 7fd97d487..89af58970 100644
--- a/src/theme/searcher/searcher.js
+++ b/src/theme/searcher/searcher.js
@@ -389,6 +389,7 @@ window.search = window.search || {};
             searchbar.select();
         } else {
             showSearch(false);
+            searchicon.blur();
         }
     }

@rustbot
Copy link
Collaborator

rustbot commented Apr 30, 2025

☔ The latest upstream changes (possibly #2681) made this pull request unmergeable. Please resolve the merge conflicts.

@rustbot rustbot added the S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. label Apr 30, 2025
@brahmlower
Copy link
Author

Hey @ehuss! Thank you for your thoughtful response 6 years ago- sorry I never reciprocated 🥴

Looks like the styling behavior described in #990 is no longer present, so I'm going to close out this PR and recommend that the related issue be marked resolved.

Screen.Recording.2025-08-17.at.4.42.31.PM.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

style: Odd outline in Chrome
3 participants