Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sidebar jumps around when selecting style variations and patterns in the Theme Previewer #130

Closed
ndiego opened this issue Jun 17, 2024 · 5 comments

Comments

@ndiego
Copy link
Member

ndiego commented Jun 17, 2024

Related to #126

This is not necessarily a bug, but the behavior felt odd. When you click on a style variation or a pattern in the sidebar of the Theme Previewer, it jumps around depending on how far down the sidebar you have scrolled. I would expect the sidebar to not change position at all.

jumping-around.mp4

Thought @WordPress/meta-design

@ryelle
Copy link
Collaborator

ryelle commented Jun 17, 2024

I think this has to do with the fact that the entire ul element is focused/focusable, so when it gets focus (which happens with both keyboard and mouse), the browser assumes it needs to be in view, and it fills the screen.

I don't know if there's a way to avoid that and still keep the accessibility expectation that the whole list is focusable.

@ndiego
Copy link
Member Author

ndiego commented Jun 17, 2024

I think this has to do with the fact that the entire ul element is focused/focusable, so when it gets focus (which happens with both keyboard and mouse), the browser assumes it needs to be in view, and it fills the screen.

Gotcha, not the end of the world. Just a bit jarring.

@StevenDufresne
Copy link
Contributor

I also noticed this, it's disorienting.

Do you think preventScroll would help here? https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#preventscroll

@jasmussen
Copy link

It makes you lose your place, that can't be great for accessibility, the focus rectangle can scroll out of view too. It would be good to look at ways to address this; does the ul element need to be focused on every click?

@ryelle
Copy link
Collaborator

ryelle commented Jun 18, 2024

The list element needs to be focusable because of the semantics of a listbox. I can look into preventScroll, that might help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants