@@ -202,7 +202,7 @@ function loadCss(cssUrl) {
202202 if ( event . ctrlKey || event . altKey || event . metaKey ) {
203203 return ;
204204 }
205- window . hideAllModals ( ) ;
205+ window . hideAllModals ( false ) ;
206206 addClass ( getSettingsButton ( ) , "rotate" ) ;
207207 event . preventDefault ( ) ;
208208 // Sending request for the CSS and the JS files at the same time so it will
@@ -378,10 +378,7 @@ function loadCss(cssUrl) {
378378 }
379379 ev . preventDefault ( ) ;
380380 searchState . defocus ( ) ;
381- // If the notable traits popover is open, and the user presses Escape,
382- // reset focus back to the link.
383- hideNotable ( true ) ;
384- window . hideAllModals ( ) ;
381+ window . hideAllModals ( true ) ; // true = reset focus for notable traits
385382 }
386383
387384 function handleShortcut ( ev ) {
@@ -771,7 +768,7 @@ function loadCss(cssUrl) {
771768 } ;
772769
773770 function showSidebar ( ) {
774- window . hideAllModals ( ) ;
771+ window . hideAllModals ( false ) ;
775772 window . rustdocMobileScrollLock ( ) ;
776773 const sidebar = document . getElementsByClassName ( "sidebar" ) [ 0 ] ;
777774 addClass ( sidebar , "shown" ) ;
@@ -848,7 +845,7 @@ function loadCss(cssUrl) {
848845 // Make this function idempotent.
849846 return ;
850847 }
851- window . hideAllModals ( ) ;
848+ window . hideAllModals ( false ) ;
852849 const ty = e . getAttribute ( "data-ty" ) ;
853850 const wrapper = document . createElement ( "div" ) ;
854851 wrapper . innerHTML = "<div class=\"docblock\">" + window . NOTABLE_TRAITS [ ty ] + "</div>" ;
@@ -1057,13 +1054,12 @@ function loadCss(cssUrl) {
10571054 /**
10581055 * Hide popover menus, notable trait tooltips, and the sidebar (if applicable).
10591056 *
1060- * This version does not do anything to tweak the focused element. The caller
1061- * should make sure it behaves reasonably.
1057+ * Pass "true" to reset focus for notable traits.
10621058 */
1063- window . hideAllModals = function ( ) {
1059+ window . hideAllModals = function ( switchFocus ) {
10641060 hideSidebar ( ) ;
10651061 window . hidePopoverMenus ( ) ;
1066- hideNotable ( false ) ;
1062+ hideNotable ( switchFocus ) ;
10671063 } ;
10681064
10691065 /**
0 commit comments