9393
9494 sidebarNode . insertBefore ( usefulLinksContainer , sidebarNode . childNodes [ 1 ] ) ;
9595
96- const searchBox = document . querySelector ( ".search-field" ) ;
97- if ( searchBox ) {
98- searchBox . setAttribute ( "name" , "Find Components" ) ;
99- searchBox . setAttribute ( "aria-expanded" , "false" ) ;
100-
101- const searchInput = searchBox . querySelector ( "input" ) ;
102- if ( searchInput ) {
103- searchInput . addEventListener ( "mouseleave" , addAriaExpanded ( "false" ) ) ;
104- searchInput . addEventListener ( "mouseout" , addAriaExpanded ( "false" ) ) ;
105- searchInput . addEventListener ( "pointerleave" , addAriaExpanded ( "false" ) ) ;
106- searchInput . addEventListener ( "pointerout" , addAriaExpanded ( "false" ) ) ;
107- searchInput . addEventListener ( "click" , addAriaExpanded ( "true" ) ) ;
108- searchInput . addEventListener ( "focusout" , addAriaExpanded ( "false" ) ) ;
109- searchInput . addEventListener ( "focus" , setListItemsAc11y ) ;
110- }
111- }
112-
113- function setListItemsAc11y ( ) {
114- const recentMenu = document . querySelector ( "#storybook-explorer-menu" ) ;
115- if ( recentMenu ) {
116- const firstLi = recentMenu . querySelector ( "li" ) ;
117- if ( firstLi ) {
118- firstLi . setAttribute ( "role" , "heading" ) ;
119- firstLi . setAttribute ( "aria-level" , "2" ) ;
120- }
121-
122- const otherLis = recentMenu . querySelectorAll ( "li:not(:first-child)" ) ;
123- if ( otherLis && otherLis . length > 0 ) {
124- for ( let i = 0 ; i < otherLis . length ; i ++ ) {
125- const li = otherLis [ i ] ;
126- const liText = li . innerText ;
127- if ( liText ) {
128- li . setAttribute ( "aria-label" , liText . trim ( ) ) ;
129- }
130- li . setAttribute ( "aria-hidden" , "true" ) ;
131- }
132- }
133- }
134- }
135-
136- function addAriaExpanded ( value ) {
137- const searchBox = document . querySelector ( ".search-field" ) ;
138- if ( searchBox ) {
139- searchBox . setAttribute ( "aria-expanded" , value ) ;
140- }
141- }
142-
14396 const sidebarSubheading = document . getElementsByClassName ( "sidebar-subheading" ) ;
14497 if ( sidebarSubheading ) {
14598 for ( let i = 0 ; i < sidebarSubheading . length ; i ++ ) {
157110 }
158111 }
159112 }
113+
160114 function setArialLabelForExpandCollapseBtn ( ) {
161115 const expandCollapseBtns = document . getElementsByClassName ( "css-rl1ij0" ) ;
162116 if ( expandCollapseBtns ) {
180134 }
181135
182136 setEventOnMenuClick ( ) ;
183- setListItemsAc11y ( ) ;
184137 }
185138
186139 function createSvg ( svgPath ) {
426379 .css-8ktt77 {
427380 display : none;
428381 }
429- </ style >
382+
383+ .css-14o7vtb {
384+ border : 2px solid transparent;
385+ }
386+
387+ .css-14o7vtb : focus-visible {
388+ outline : auto;
389+ }
390+ .search-field {
391+ display : none !important ;
392+ }
393+ </ style >
0 commit comments