Repository navigation
fix(wasm-a11y): Mirror scroll geometry in the semantic DOM - #25587
Conversation
Mirrors ScrollViewer::InvalidateScrollInfo_TryUpdateValues: extent and viewport changes are now reported to automation clients, not only offset changes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The semantic scroller of a scroll port took its range from its sparse semantic children, so the browser clamped the mirrored offset and fed the clamped value back, stopping scrolling before the end. - size the native scroll range from the managed extent - position semantic children in content coordinates - ignore scroll events echoing a managed sync - sync ScrollPresenter scroll ports as well Fixes #24867 Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
|
Claude finished @morning4coffe-dev's task in 23s —— View job Review summaryVerdict: fix-first (minor). The approach is sound. The managed extent defines the native range through a pseudo-element, the offset is applied once, and the extent/viewport events mirror WinUI. I only read the diff; I did not build or run anything, and the new tests are Issues: 0 high, 1 medium, 1 low.
Cross-cutting notes:
|
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
The build 240297 found UI Test snapshots differences: Details
|
Xiaoy312
left a comment
There was a problem hiding this comment.
Approving: this fixes #24867 for the common case (an unzoomed, vertical ScrollViewer or ScrollView). The findings below can be fixed here or tracked as follow-ups; the medium ones are the ones I'd look at first. All of this comes from reading the code at 7606b02eaf. I haven't run the new runtime tests.
Medium
-
Zoom brings the bug back.
- In
UpdateNativeScrollOffsets(WebAssemblyAccessibility.cs:1118-1128), theScrollContentPresenterbranch sends the unzoomedExtentWidth/ExtentHeight, butScrollContentPresenter.Managed.cs:100,340clamps offsets againstExtent * _zoomFactor. GetRectInSemanticParentalso ignores zoom, for both scrollers.- Example: ZoomFactor 2, 1000px content, 200px viewport. The managed max offset is 1800 but the native max is 800.
- Because the browser's clamped position is then stored as the expected echo, the old visible feedback loop becomes a silent mismatch between managed and native.
- Suggestion: send the scaled extent for both scrollers, scale child rects, and add a test with zoom ≠ 1.
- In
-
The
ScrollViewer.cschange affects every platform, but only a WASM test covers it.- The only proof for commit 1 is the last assertion of a WASM-only test.
- A cross-platform runtime test using
AutomationPeer.TestAutomationPeerListener(same pattern asGiven_ProgressBar.uno.cs:34-52) would cover it: grow the content, then assertVerticalViewSize/VerticallyScrollableare raised. - It would also help to cite the
// MUX Referencefor theInvalidateScrollInfo_TryUpdateValuesparity.
-
The code doesn't agree on what counts as a scroll port.
RegisterAsScrollPortis public.GetRectInSemanticParentand the forced-scroller block act on anyIsScrollPort, butUpdateNativeScrollOffsetsandOnScrollonly handleScrollContentPresenterandScrollPresenter.- A third-party scroll port therefore gets content coordinates without anything applying the scroll offset.
- One internal scroll-port geometry accessor, implemented by the scrollers, with a fallback to the old transform path, would fix this and the
TODO (DOTI)type switch together.
-
Every scroll port is now a native scroller on both axes (
WebAssemblyAccessibility.cs:2177-2183).- This ignores
ScrollMode=Disabled: a ScrollView with horizontal scroll disabled could be scrolled horizontally from the browser. Worth a test that setsscrollLeftand assertsHorizontalOffsetstays 0. - Recent Chrome makes a scroll container with no focusable children a keyboard tab stop. Please check the tab order.
- Setting horizontal and vertical overflow from
IScrollProviderscrollability would avoid both problems; the*ScrollablePropertychanges are already listened to.
- This ignores
-
Per-frame cost with accessibility on.
- Each
updateNativeScrollOffsetscall doesclassList.add, twosetPropertycalls, writes the offsets, then reads them back. That read forces a synchronous layout on every animation or inertia frame. - The
--uno-scroll-extent-*variables inherit, so an extent change restyles the whole semantic subtree. - A single layout pass can trigger up to six identical syncs, one per ScrollPattern property (
WebAssemblyAccessibility.cs:2622-2635). - Suggestions: skip writes when nothing changed (cache in the existing WeakMap), merge the syncs into one per frame, and use
@property { inherits: false }or a dedicated sizer element.
- Each
-
The tests don't cover why the echo filter exists.
- The filter is there to avoid cancelling animations and inertia, but no test checks that. An animated
ChangeViewwith accessibility on, asserting the final offset is reached, would cover it. - In the first test, the assertion after the extent change only uses
WaitForIdle;WaitForwould be more robust.
- The filter is there to avoid cancelling animations and inertia, but no test checks that. An animated
-
OnScrollhas no logging. It's now a two-way sync point, but it's the only handler in that block called from JS without a trace log (OnInvoke,OnToggleandOnRangeValueChangehave one). A trace of requested vs. clamped offsets, plus a debug log when the owner is neither scroller, would make "stuck offset" reports diagnosable.
Questions
- Which real user or assistive-technology action scrolls the semantic div from the browser side? Wheel is blocked, so that leaves focus
scrollIntoView, a screen reader's virtual cursor, and touch. Was this tried with an actual screen reader (NVDA/JAWS on Chrome, VoiceOver) on the #24867 page? The tests setscrollTopdirectly. - Does
When_ScrollViewer_Scrolled_Then_Semantic_Children_Stay_In_Content_Coordinatesfail on master? A run that fails before the fix and passes after would confirm the double shift. - RTL (the sign of
scrollLeft), nested scrollers, and virtualized ItemsRepeater/ListView extents: covered or out of scope? - #24597 adds overlapping echo and animation suppression. If both merge, which one owns this?
Low
- The echo filter can drop a real scroll. A user scroll that lands exactly on the last synced position is ignored. This is more likely for
ScrollPresenter, which never pushes its offset back. Relatedly, the push-back for a child that hangs past the content only exists forScrollContentPresenter; test 4 has no ScrollView variant. ScrollViewer.cs:835usesGetOrCreateAutomationPeer(), while:1319in the same file usesGetAutomationPeer(). The new call creates a peer during layout for every templated ScrollViewer whenever a listener exists. Please either confirm WinUI does the same or align with:1319.- When
TrimOverscrollorRecomputeOffsetsFromIntentmoves the offset in the same pass,Update()and the new block may both raise the percent events, with different "old" values. - The eight old-value property reads in
UpdateDimensionPropertiesrun on every arrange, on every platform. They could be done only afterListenerExistsHelperreturns true.oldExtent*also duplicatesoldSize. - Consider
overflow-anchor: noneon.uno-semantic-scroll-port, so scroll anchoring can't movescrollTopon its own and defeat the exact echo match. - Tests:
Task.Delay(100)is a timing-based wait; polling that the offset stays put would be sturdier.offsetTop == 400pins the positioning approach; the child's rect relative to the port would check what assistive technology actually sees.- Every test is vertical.
- Nits:
localRectatWebAssemblyAccessibility.cs:822is now only used in theelsebranch.- The class summary of
Given_AccessibleScrollViewer(region role) no longer matches what the class tests. - Commit 1's subject could say "scroll automation events".
- In debug mode, a
console.debugfor suppressed echoes, missing elements and non-finite extents would help. - Debug mode makes the semantic overlay visible, and its scrollbars are now hidden there too. Is that intended?
Info
- Not caused by this PR, but right next to it:
ScrollViewer.cs:818readsnew Size(ExtentWidth, ExtentWidth), soExtentSizeChangedmisses changes that only affect height. - Browser-initiated scrolls on a
ScrollPresenternow ignore snap points (ScrollTo→ScrollToOffsets). That matchesSetScrollPercentand seems intended; it may be worth mentioning in the PR description. - Browsers cap element sizes, so a very large virtualized extent will get a truncated native range.
- No security concerns: the values passed to
setPropertyare numbers, and the test JS strings are built only from internal values.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
|
Claude finished @morning4coffe-dev's task in 49s —— View job Review summaryVerdict: ship, with minor follow-ups. I read the diff at The latest commits address most of the earlier review:
Issues: 0 high, 0 medium, 2 low. Both are inline:
Cross-cutting notes:
|
|
@Xiaoy312 thanks, addressed in fddabc5:
The |
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
The build 240794 found UI Test snapshots differences: Details
|
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
|
Claude finished @morning4coffe-dev's task in 19s —— View job Review summaryVerdict: ship. I read the new commit Issues: 0 high, 0 medium, 0 low. New commit:
Earlier feedback:
|
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
|
Claude finished @morning4coffe-dev's task in 18s —— View job Review summaryVerdict: ship. I read the new commit Issues: 0 high, 0 medium, 0 low. What the commit does:
Remaining notes (non-blocking):
|
|
Remaining review notes, as of 696facf:
Automation runtime tests (Skia WASM): 420 passed, 0 failed. |
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
|
Claude finished @morning4coffe-dev's task in 12s —— View job Review summaryVerdict: ship. I read the newest commit, Issues: 0 high, 0 medium, 0 low. New commit:
Earlier feedback: nothing new to add to the 696facf review.
The docs checklist item is still unchecked. For a WASM accessibility bugfix this is probably fine, so it is your call. |
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
The build 240881 found UI Test snapshots differences: Details
|
|
|
fix(wasm-a11y): Mirror scroll geometry in the semantic DOM (backport #25587)
…noplatform#25587) Manual port to servicing/6.8. Conflicts resolved: - JSImport namespace kept as Uno.UI.Runtime.Skia.Accessibility (6.8 naming). - ScrollContentPresenter keeps the 6.8 `!IS_UNIT_TESTS` condition on ICustomClippingElement. - ScrollPresenter keeps 6.8's _borderRenderer field. - Test listener drops IAutomationPeerListener members that 6.8 doesn't have. (cherry picked from commit eed8397)
GitHub Issue: closes #24867
PR Type:
🐞 Bugfix
What changed? 🚀
With accessibility enabled on WebAssembly, every scroll port (
ScrollContentPresenter,ScrollPresenter) gets a semantic<div>withoverflow: scroll, and its offset is mirrored to and from the XAML scroller. That<div>never had the scroller's geometry, though:Border, spacing, aGridfull of drawn content…) did not count, so the range usually ended at the last labeled element. When the XAML offset was mirrored, the browser clampedscrollTop, raised ascrollevent with the clamped value, andOnScrollpushed it back into theScrollViewer. In practice you can't scroll to the bottom of a long page once accessibility is on.scrollTopthen moved them again.What this PR does:
::beforepseudo-element sized through two CSS variables (--uno-scroll-extent-width/height) defines the scrollable area. Being a pseudo-element, it doesn't interfere with the index-based insertion of semantic children. Native scrollbars are hidden on these elements, so the client area matches the XAML viewport.updateNativeScrollOffsetsnow receives the extent along with the offsets and applies it first, so the browser never has to clamp.ScrollViewer.UpdateDimensionPropertiesnow raises the scroll pattern events when the extent or viewport changes, mirroringScrollViewer::InvalidateScrollInfo_TryUpdateValuesin WinUI. Before, only offset changes were raised, so content growing or shrinking never reached the semantic DOM.updateNativeScrollOffsetsis remembered and compared exactly. Forwarding those echoes would restartScrollPresenteranimations and complete touch inertia onScrollContentPresenter. This overlaps with fix(a11y): Don't feed semantic scroll echoes back to ScrollViewer #24597. With the range now matching the extent there's no clamping left to tolerate, so the check can be exact.ScrollPresenterscroll ports are synced too. They were never real native scrollers: the overflow was decided from the peer's scrollability at creation time, before layout. Scroll ports are now always native scroll containers. Browser-initiated scrolls go throughScrollToOffsets, the same non-animated pathScrollPresenterAutomationPeeruses forSetScrollPercent.ScrollContentPresenteroffset is pushed back. This covers semantic children drawn outside the content bounds (e.g. aCanvaschild below the canvas), which can still make the native range a bit larger than the XAML one.Related: #24596, #24597
PR Checklist ✅
Screenshots Compare Test Runresults.🤖 Generated with Claude Code