eui icon indicating copy to clipboard operation
eui copied to clipboard

[Docs] page no longer scrolls to section when clicking in the sidenav

Open chandlerprall opened this issue 3 years ago • 3 comments

The logic in scroll_to_hash.tsx still fires correctly to focus the section & scroll to it, but the added EuiScreenReaderLive+EuiSkipLink combination fights back, taking focus again & I believe that is also reverting the scroll position.

chandlerprall avatar Aug 08 '22 20:08 chandlerprall

Great catch! I was wondering why this was happening 😬

cee-chen avatar Aug 08 '22 20:08 cee-chen

Actually - am I going crazy or does this focus fighting primarily seem to only happen on webpack dev hot reload? It isn't happening at all on prod during normal run of the mill browsing or page refreshing (e.g. https://elastic.github.io/eui/#/theming/theme-provider#simple-instance-overrides)

cee-chen avatar Aug 08 '22 20:08 cee-chen

Ah, it happens for me in prod&dev but only when navigating to a sub-section through the sidenav - initial page load always scrolls to the target section.

Dug in a little more and it looks like the scrolling issue is solved by passing { preventScroll: true } to the focus call in EuiScreenReaderLive. There's still a fight between this focus code and similar in scroll_to_hash.tsx, so we need to decide how we want to handle that instead of trying to focus 2 locations 😅

chandlerprall avatar Aug 09 '22 20:08 chandlerprall

It's not happening for me on prod/latest Firefox or Chrome personally:

screencap

Can you take a screencap of what you're seeing?

I have seen it happen on local dev but I think that was during hot reloads 🤔

cee-chen avatar Aug 10 '22 15:08 cee-chen

Ah, there are so many ways to get somewhere! It happens when going from one page to another page's subsection.

https://user-images.githubusercontent.com/313125/183977504-4e6ed747-5d26-446b-abe7-6226400938fc.mov

chandlerprall avatar Aug 10 '22 17:08 chandlerprall

ohh i totally brainfarted on search! that makes sense, thank you!

cee-chen avatar Aug 10 '22 17:08 cee-chen