[CTW] Bounds incorrect for scrolled position: sticky elements
Categories
(Core :: Disability Access APIs, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox111 | --- | fixed |
People
(Reporter: Jamie, Assigned: morgan)
References
Details
(Whiteboard: [ctw-m5])
Attachments
(1 file, 2 obsolete files)
Similar to bug 1809836, but we decided to handle this separately.
STR:
- Open this test case:
data:text/html,<div style="position: sticky; top: 0px;"><button>top</button></div><script> for (let i = 0; i < 1000; ++i) { const div = document.createElement("div"); div.innerHTML = `<button>${i}</button>`; document.body.append(div); } </script> - Get the Accessible for the "top" button.
- Get its bounds.
- Scroll the page to the bottom.
- Get the bounds for the "top" Accessible.
- Expected: Same as step 3.
What's interesting is that on current mozilla-central, this actually works as expected! That surprised me, so I did a bit of debugging. It turns out that the cached relative-bounds for the div get updated every time you scroll. The y offset gets larger and larger, compensating for the increasing scroll offset. I'm not sure if this is due to the original reflow notification or the position change notification I added recently in bug 1812208.
| Reporter | ||
Comment 1•3 years ago
|
||
Morgan, I forget some of the details of our conversation about this, but I vaguely recall this is basically the "naive approach" we discussed... except that it seems we already get the required notifications without any change at all. 😲 Surely it can't be this simple? Of course, we'll need to see whether this turns out to be a performance problem with regular bounds cache updates.
Nathan, I'd be interested to know whether any of the position: sticky failures you've seen in the wild are magically working now. Note that this will still probably break if the position: sticky element doesn't have an Accessible (bug 1814800 but for sticky), so if it doesn't, you might need to force one by adding, say, role="group" before you scroll.
| Reporter | ||
Comment 2•3 years ago
|
||
(In reply to James Teh [:Jamie] from comment #0)
I'm not sure if this is due to the original reflow notification or the position change notification
I verified that it's due to the position change notification, not reflow.
| Reporter | ||
Comment 3•3 years ago
|
||
Test case:
data:text/html,<div><p>1</p><p style="position: sticky; top: 0px;">sticky</p><hr style="height: 100vh;"><p>2</p>
Before you scroll, sticky's bounds are correctly below the "1". If you scroll to the bottom of the document, sticky's bounds now report the top of the document.
Comment 4•3 years ago
•
|
||
(In reply to James Teh [:Jamie] from comment #1)
Nathan, I'd be interested to know whether any of the position: sticky failures you've seen in the wild are magically working now. Note that this will still probably break if the position: sticky element doesn't have an Accessible (bug 1814800 but for sticky), so if it doesn't, you might need to force one by adding, say, role="group" before you scroll.
Most of these issues in the wild have been position: fixed. I've found one major position: sticky issue in the wild which I've been struggling to reproduce for a while now: the Twitter tablist that holds "For you," "Trending", "News," "Sports," and so on. I've been unable to get the Testcase Reducer extension to get me a good isolated test of the position: sticky issue on Twitter, despite that being reasonably straightforward for position: fixed. That said, if I add role="group" to the parent div that has position: sticky for that Twitter tablist, the bounds issue is fixed. Do we want a separate bug for that? I think it is probably the same thing as what you've described here, so I doubt we need one yet.
Also, the test case you provided in comment #3 works for me in latest Nightly.
| Reporter | ||
Comment 5•3 years ago
|
||
(In reply to Nathan LaPré from comment #4)
Most of these issues in the wild have been position: fixed.
I assume those are mostly fixed now apart from those that are still impacted by bug 1814800?
That said, if I add
role="group"to the parent div that has position: sticky for that Twitter tablist, the bounds issue is fixed. Do we want a separate bug for that?
No; I'll expand bug 1814800 to cover it. Thanks for confirming.
| Comment hidden (duplicate) |
Comment 7•3 years ago
|
||
(In reply to James Teh [:Jamie] from comment #5)
(In reply to Nathan LaPré from comment #4)
Most of these issues in the wild have been position: fixed.
I assume those are mostly fixed now apart from those that are still impacted by bug 1814800?
Yup. In particular, the LinkedIn and Google search menu bars are now fixed after scrolling. The Twitter bottom bar, with "Log In" and "Sign Up" is still broken due to the display: flex issue.
| Reporter | ||
Comment 8•3 years ago
|
||
| Assignee | ||
Comment 9•3 years ago
|
||
| Assignee | ||
Comment 10•3 years ago
|
||
Updated•3 years ago
|
| Assignee | ||
Comment 11•3 years ago
|
||
adding the patch I had locally for this, in case it becomes relevant later. also phab'd the test case I have, since it includes a test of style mutation which I think we should have in central. I'm wondering if all the position:fixed work from earlier is necessary now, or if that's covered by the position change notification too. I'll check
Updated•3 years ago
|
Comment 12•3 years ago
|
||
| Assignee | ||
Updated•3 years ago
|
Comment 13•3 years ago
|
||
| bugherder | ||
Description
•