@@ -202,7 +202,7 @@ function loadCss(cssUrl) {
202
202
if ( event . ctrlKey || event . altKey || event . metaKey ) {
203
203
return ;
204
204
}
205
- window . hideAllModals ( ) ;
205
+ window . hideAllModals ( false ) ;
206
206
addClass ( getSettingsButton ( ) , "rotate" ) ;
207
207
event . preventDefault ( ) ;
208
208
// Sending request for the CSS and the JS files at the same time so it will
@@ -378,10 +378,7 @@ function loadCss(cssUrl) {
378
378
}
379
379
ev . preventDefault ( ) ;
380
380
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
385
382
}
386
383
387
384
function handleShortcut ( ev ) {
@@ -771,7 +768,7 @@ function loadCss(cssUrl) {
771
768
} ;
772
769
773
770
function showSidebar ( ) {
774
- window . hideAllModals ( ) ;
771
+ window . hideAllModals ( false ) ;
775
772
window . rustdocMobileScrollLock ( ) ;
776
773
const sidebar = document . getElementsByClassName ( "sidebar" ) [ 0 ] ;
777
774
addClass ( sidebar , "shown" ) ;
@@ -848,7 +845,7 @@ function loadCss(cssUrl) {
848
845
// Make this function idempotent.
849
846
return ;
850
847
}
851
- window . hideAllModals ( ) ;
848
+ window . hideAllModals ( false ) ;
852
849
const ty = e . getAttribute ( "data-ty" ) ;
853
850
const wrapper = document . createElement ( "div" ) ;
854
851
wrapper . innerHTML = "<div class=\"docblock\">" + window . NOTABLE_TRAITS [ ty ] + "</div>" ;
@@ -1057,13 +1054,12 @@ function loadCss(cssUrl) {
1057
1054
/**
1058
1055
* Hide popover menus, notable trait tooltips, and the sidebar (if applicable).
1059
1056
*
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.
1062
1058
*/
1063
- window . hideAllModals = function ( ) {
1059
+ window . hideAllModals = function ( switchFocus ) {
1064
1060
hideSidebar ( ) ;
1065
1061
window . hidePopoverMenus ( ) ;
1066
- hideNotable ( false ) ;
1062
+ hideNotable ( switchFocus ) ;
1067
1063
} ;
1068
1064
1069
1065
/**
0 commit comments