[Global Search] Return focus to live region after page re-render even when left nav is open (#186430)

## Summary

Closes https://github.com/elastic/kibana/issues/186423 

This code is interfering with the focus to the ScreenReaderLive region
which is needed to announce page renders for assistive technologies.

### After


https://github.com/user-attachments/assets/8b6141d1-201c-47fd-9c03-992ae7f275ce

Note the active element after the click is now the EuiScreenReaderOnly
element to announce the page title

### To Test

Add `document.activeElement` in the developer tools console to see what
element is active when testing keyboard navigation. After clicking a
link, it should return focus to the ScreenReaderLive component to
announce the page title to the user.
This commit is contained in:
Rachel Shen 2024-07-23 14:58:10 -06:00 committed by GitHub
parent 26dd61efa2
commit c17d335b48
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -182,9 +182,6 @@ export function Header({
onIsLockedUpdate={onIsLockedUpdate}
closeNav={() => {
setIsNavOpen(false);
if (toggleCollapsibleNavRef.current) {
toggleCollapsibleNavRef.current.focus();
}
}}
customNavLink$={observables.customNavLink$}
button={