File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -10,12 +10,19 @@ import {LightTheme} from '../theme'
1010import { LinkNoUnderline } from './link'
1111import * as getNav from '../util/get-nav'
1212import omit from '../util/omit'
13+ import { announce } from '../util/aria-live'
1314
14- const SearchResults = ( { results, getItemProps, highlightedIndex} ) => {
15+ const SearchResults = ( { results, getItemProps, highlightedIndex, isOpen } ) => {
1516 const siteMetadata = useSiteMetadata ( )
1617
18+ React . useEffect ( ( ) => {
19+ if ( isOpen && ( ! results || results . length === 0 ) ) {
20+ announce ( 'No results' )
21+ }
22+ } , [ results , isOpen ] )
23+
1724 if ( ! results || results . length === 0 ) {
18- return < Box sx = { { fontSize : 2 , px : 3 , py : 3 } } > No results</ Box >
25+ return < Box sx = { { fontSize : 2 , px : 3 , py : 3 } } aria-live = "assertive" > No results</ Box >
1926 }
2027
2128 return (
You can’t perform that action at this time.
0 commit comments