@@ -795,7 +795,7 @@ function loadCss(cssUrl) {
795
795
// This means when the window is resized, we need to redo the layout.
796
796
const base = window . CURRENT_NOTABLE_ELEMENT . NOTABLE_BASE ;
797
797
const force_visible = base . NOTABLE_FORCE_VISIBLE ;
798
- hideNotable ( ) ;
798
+ hideNotable ( false ) ;
799
799
if ( force_visible ) {
800
800
showNotable ( base ) ;
801
801
base . NOTABLE_FORCE_VISIBLE = true ;
@@ -846,7 +846,7 @@ function loadCss(cssUrl) {
846
846
// Make this function idempotent.
847
847
return ;
848
848
}
849
- hideNotable ( ) ;
849
+ hideNotable ( false ) ;
850
850
const ty = e . getAttribute ( "data-ty" ) ;
851
851
const wrapper = document . createElement ( "div" ) ;
852
852
wrapper . innerHTML = "<div class=\"docblock\">" + window . NOTABLE_TRAITS [ ty ] + "</div>" ;
@@ -883,7 +883,7 @@ function loadCss(cssUrl) {
883
883
return ;
884
884
}
885
885
if ( ! e . NOTABLE_FORCE_VISIBLE && ! elemIsInParent ( event . relatedTarget , e ) ) {
886
- hideNotable ( ) ;
886
+ hideNotable ( true ) ;
887
887
}
888
888
} ;
889
889
}
@@ -903,14 +903,16 @@ function loadCss(cssUrl) {
903
903
// To work around this, make sure the click finishes being dispatched before
904
904
// hiding the popover. Since `hideNotable()` is idempotent, this makes Safari behave
905
905
// consistently with the other two.
906
- setTimeout ( hideNotable , 0 ) ;
906
+ setTimeout ( ( ) => hideNotable ( false ) , 0 ) ;
907
907
}
908
908
}
909
909
910
- function hideNotable ( ) {
910
+ function hideNotable ( focus ) {
911
911
if ( window . CURRENT_NOTABLE_ELEMENT ) {
912
912
if ( window . CURRENT_NOTABLE_ELEMENT . NOTABLE_BASE . NOTABLE_FORCE_VISIBLE ) {
913
- window . CURRENT_NOTABLE_ELEMENT . NOTABLE_BASE . focus ( ) ;
913
+ if ( focus ) {
914
+ window . CURRENT_NOTABLE_ELEMENT . NOTABLE_BASE . focus ( ) ;
915
+ }
914
916
window . CURRENT_NOTABLE_ELEMENT . NOTABLE_BASE . NOTABLE_FORCE_VISIBLE = false ;
915
917
}
916
918
const body = document . getElementsByTagName ( "body" ) [ 0 ] ;
@@ -923,7 +925,7 @@ function loadCss(cssUrl) {
923
925
e . onclick = function ( ) {
924
926
this . NOTABLE_FORCE_VISIBLE = this . NOTABLE_FORCE_VISIBLE ? false : true ;
925
927
if ( window . CURRENT_NOTABLE_ELEMENT && ! this . NOTABLE_FORCE_VISIBLE ) {
926
- hideNotable ( ) ;
928
+ hideNotable ( true ) ;
927
929
} else {
928
930
showNotable ( this ) ;
929
931
window . CURRENT_NOTABLE_ELEMENT . setAttribute ( "tabindex" , "0" ) ;
@@ -946,7 +948,7 @@ function loadCss(cssUrl) {
946
948
}
947
949
if ( ! this . NOTABLE_FORCE_VISIBLE &&
948
950
! elemIsInParent ( event . relatedTarget , window . CURRENT_NOTABLE_ELEMENT ) ) {
949
- hideNotable ( ) ;
951
+ hideNotable ( true ) ;
950
952
}
951
953
} ;
952
954
} ) ;
@@ -1057,7 +1059,7 @@ function loadCss(cssUrl) {
1057
1059
onEachLazy ( document . querySelectorAll ( ".search-form .popover" ) , elem => {
1058
1060
elem . style . display = "none" ;
1059
1061
} ) ;
1060
- hideNotable ( ) ;
1062
+ hideNotable ( false ) ;
1061
1063
} ;
1062
1064
1063
1065
/**
0 commit comments