Re: [csswg-drafts] [css-nav-1] Starting point can be off-screen (#3391)

> In Chrome today, when activeElement gets removed or hidden, we search from the first visible ancestor scroller's edge. Why is it better to search from the disappeared element's rect?

@hugoholgersson , Because the user may want to focus the certain position of the page if he/she loses the focused element. 
The reason for making the element disappears isn't the user's intention. It's because the page changes dynamically.
So the user will be confused when the focus moves unintentionally.

If we search from the first visible ancestor scroller, it may look like the page suddenly scrolls to the top when the disappeared element had been positioned at the end of the scroller.
[Here](https://docs.google.com/document/d/1mmi3iPcuJMKwYzEWpLAV7Gi_n6aLto6CPEL7H8N24BI/edit) is a more detailed explanation from @junho

It would be nice to reset the search origin considering the last change the page performed and the user's action. I'd like to suggest to resolve like below:

1. If the search origin becomes off-screen by scrolling, 
    set the **scroll container** as the search origin.

2.  If the search origin becomes invisible/inactive (`display: none`, `visibility: hidden`, `inert`),
     set the **rect of the previous search origin** as the search origin.



-- 
GitHub Notification of comment by jihyerish
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3391#issuecomment-528303640 using your GitHub account

Received on Thursday, 5 September 2019 10:33:22 UTC