Tab key does not trigger infinite scroll on Youtube video lists
Categories
(Core :: Layout: Scrolling and Overflow, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox117 | --- | fixed |
People
(Reporter: Jamie, Assigned: dlrobertson)
References
Details
(Keywords: access)
Attachments
(1 file)
STR:
- Open this page: https://www.youtube.com/@LGR/videos
- Take note of the last video link rendered in the DOM. An easy way to get this is to open the web console and paste this command:
vids = document.querySelectorAll("#video-title-link[href]"); vids[vids.length - 1].textContent
- Keep pressing tab until the video link from 2) is focused.
- Press tab twice more to get to the next video link.
- Expected: The next video link is focused.
- Actual: Focus hits the browser chrome.
- Shift+tab twice back to the video link from 2).
- Press down arrow twice to scroll down a bit.
- Press tab twice more to get to the next video link.
- Observe: The next video link is focused.
Impact: This makes it impossible for keyboard and screen reader users to scroll to earlier videos that aren't initially rendered.
This works as expected in Chrome.
I'm not sure whether this belongs here, in DOM: UI event sand focus handling or somewhere else.
Reporter | ||
Updated•2 years ago
|
Reporter | ||
Comment 1•2 years ago
|
||
This was reported to me on Mastodon, so this is already impacting users in the wild:
https://hkc.social/@nick/109899409603035123
Reporter | ||
Comment 2•2 years ago
|
||
Note that as well as keyboard scrolling, this impacts scrolling via accessibility APIs (Accessible::ScrollTo), so screen reader users can't scroll this with browse/review cursors either. However, I suspect fixing the former should fix the latter.
Reporter | ||
Comment 3•2 years ago
|
||
Curiously, scrolling with JS seems to work:
vids = document.querySelectorAll("#video-title-link[href]"); vids[vids.length - 1].scrollIntoView()
So there must be something different about the scroll events we generate with tab/accessibility that Youtube doesn't like?
Comment 4•2 years ago
|
||
Ksenia, can you take a look at this?
Assignee | ||
Comment 5•2 years ago
|
||
(In reply to James Teh [:Jamie] from comment #0)
[...]
Impact: This makes it impossible for keyboard and screen reader users to scroll to earlier videos that aren't initially rendered.
Sorry for the delayed response! Thanks for the detailed STR. It was very easy to reproduce this.
This works as expected in Chrome.
I was also able to see the expected behavior with Chrome, but then I noticed that on tab scroll, when the item is not entirely in view, the scrollIntoView
call that chrome must use, must be block: 'center'
or something like that because the item ends up around the center of the screen. This is then what causes items afterwards to be rendered in. To verify this I reduced the Chrome window to a much smaller size and Chrome then had the same behavior as us. It was a bit tricky to get the Chrome window to have the right size, but I was eventually able to get it.
I'm not sure whether this belongs here, in DOM: UI event sand focus handling or somewhere else.
I am also unsure. For now lets leave this here, but my best guess is that this could be an issue with scrollIntoView
which AFAIK would be Layout: Scrolling and Overflow
.
Assignee | ||
Updated•2 years ago
|
Comment 6•2 years ago
|
||
We have a known issue on file for scrollIntoView()
with block: center
, bug 1826158 -- I wonder if that could be related.
Assignee | ||
Comment 7•2 years ago
|
||
(In reply to James Teh [:Jamie] from comment #3)
Curiously, scrolling with JS seems to work:
vids = document.querySelectorAll("#video-title-link[href]"); vids[vids.length - 1].scrollIntoView()
So there must be something different about the scroll events we generate with tab/accessibility that Youtube doesn't like?
Per Element.scrollIntoView the default value is {block: 'start'}
, which for most screens would cause later videos to be rendered. Note that running the above code block would also cause later elements to be rendered if {block: 'center'}
was given. I'm starting to think that the issue is with the scroll events we generate for tab scrolls. I don't know much about how they work, but it seems like we should be generating a scrollIntoView
call with something other than {block: 'end'}
(which is what I bet we're currently emitting). I think it is important to not that switching to something like using a different value for the block
argument would be just a workaround. AFAIK it would still be possible to end up with a tab scroll that should cause more content to be rendered, but does not due to the element size and the current viewport size (similar to what currently happens with chrome in this comment).
Assignee | ||
Comment 8•2 years ago
|
||
(In reply to Botond Ballo [:botond] from comment #6)
We have a known issue on file for
scrollIntoView()
withblock: center
, bug 1826158 -- I wonder if that could be related.
Based on what i found in bug 1818126 comment 7, I don't think bug 1826158 is related. I think we probably emit a scrollIntoView()
call with {block: 'end'}
. If you run the following, more videos should be rendered.
vids = document.querySelectorAll("#video-title-link[href]")
vids[vids.length - 1].scrollIntoView({block: 'center'})
Assignee | ||
Comment 9•2 years ago
|
||
I think that the scrollIntoView
call that could load more content is coming from here. I changed this to WhereToScroll::Center
and things seem to look Chrome-like, but the tab scroll continued onto the browser chrome at the same point (regardless of us rendering more content that is tab-scrollable).
Comment 10•2 years ago
|
||
My comment in bug 1535232 comment 0 would be somewhat related. In short not specifying WhereToScroll::Center
in nsFocusManager::ScrollIntoView is intentional for "Find in page" function, but for other functionalities I think we have never considered what the preferable behavior is.
Also note that as for Element.focus()
the HTML standard spec doesn't define where to scroll, it just mentions
block flow direction position set to an implementation-defined value,
Assignee | ||
Comment 11•2 years ago
|
||
This bug came up in our APZ planning meeting. Marking this as S2 and we plan to dig into this in our upcoming stabilization sprint.
Updated•2 years ago
|
Assignee | ||
Comment 12•2 years ago
|
||
After a bit more investigation:
- Chrome definitely centers an element on tab scroll when the element is offscreen
- Element.focus() also centers an element for both Chrome and Safari
So I think we should change WhereToScroll::Nearest
to WhereToScroll::Center
for the ScrollContentIntoView
in nsFocusManager::ScrollIntoView. I did some testing and this gets us to the same behavior as Chrome. That being said, it is possible to cause the unwanted behavior intermittently (same as Chrome).
Assignee | ||
Comment 13•2 years ago
|
||
Chrome and safari center an element on Element.focus() when the element
needs to be scrolled into view. Update our implementation to do the
same.
Updated•2 years ago
|
Updated•2 years ago
|
Comment 14•2 years ago
|
||
Comment 15•2 years ago
|
||
bugherder |
Assignee | ||
Updated•1 years ago
|
Assignee | ||
Updated•1 years ago
|
Updated•1 years ago
|
Comment 16•1 year ago
|
||
Reproduced the issue on Nightly 112.0a1 (2023-02-21) following the STR, on macOS 13, Windows 11 and Ubuntu 22.
Verified it on Nightly 118.0a1 (2023-08-21) Beta 117.0b9 builds on macOS 13, Windows 11 and Ubuntu 22, and can confirm that the issue is fixed.
Updated•1 year ago
|
Description
•