File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
lib/rdoc/generator/template/aliki/js Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,20 @@ function hookSearch() {
9797 const search = createSearchInstance ( input , result ) ;
9898 if ( ! search ) return ;
9999
100+ // Hide search results when clicking outside the search area
101+ document . addEventListener ( 'click' , ( e ) => {
102+ if ( ! e . target . closest ( '.navbar-search-desktop' ) ) {
103+ result . setAttribute ( 'aria-expanded' , 'false' ) ;
104+ }
105+ } ) ;
106+
107+ // Show search results when focusing on input (if there's a query)
108+ input . addEventListener ( 'focus' , ( ) => {
109+ if ( input . value . trim ( ) ) {
110+ result . setAttribute ( 'aria-expanded' , 'true' ) ;
111+ }
112+ } ) ;
113+
100114 // Check for ?q= URL parameter and trigger search automatically
101115 if ( typeof URLSearchParams !== 'undefined' ) {
102116 const urlParams = new URLSearchParams ( window . location . search ) ;
You can’t perform that action at this time.
0 commit comments