Repository navigation
[web][a11y] Initialize slider semantics values when enabling - #195564
auto-submit[bot] merged 2 commits into
Conversation
When a slider is enabled after its semantics node already exists, the web engine attaches a new SemanticIncrementable role to a node whose value, increasedValue, and decreasedValue fields are not dirty. _updateInputValues() then returns early on the role's first update(), so the hidden <input type="range"> is exposed to assistive technology without value, min, max, aria-valuetext, aria-valuenow, aria-valuemin, or aria-valuemax. The browser announces the default range value until the slider's value changes once. Start _pendingResync as true so a newly attached role performs one initial input-value sync on its first update, as proposed by @cashmula in flutter#195215. The flag is cleared after that sync; its role in change-event handling is unchanged. Fixes flutter#195215 Assisted-by: Devin AI
There was a problem hiding this comment.
Code Review
This pull request updates the initial value of _pendingResync to true in SemanticIncrementable to ensure that newly attached roles sync their initial range attributes even when the semantics object's value fields are not dirty. It also adds three regression tests in semantics_test.dart to verify that input values are populated and resynced correctly under various conditions, including when the role is added to a clean node, reattached with clean values, or added in pointer-events mode. There are no review comments, so I have no feedback to provide.
flutter-zl
left a comment
There was a problem hiding this comment.
LGTM, thanks for the fix and the clear root-cause write-up.
I verified it with before and after demos built from the issue's repro:
- Before: https://flutter-demo-94-before.web.app
- After: https://flutter-demo-94-after.web.app
After clicking "Enable B", the before build leaves slider B's input with aria-valuetext=null, value=50 and no min/max. The after build has "B within 5 km" with value, min and max set, matching slider A.
flutter/flutter@9347202...3623d2d 2026-11-04 [email protected] Roll Skia from 49ec2655bf51 to aaa39bfcd393 (5 revisions) (flutter/flutter#195956) 2026-11-04 [email protected] Roll pub packages (flutter/flutter#195950) 2026-11-04 [email protected] Roll pub packages (flutter/flutter#195948) 2026-11-04 [email protected] local_engine_builds_common out of bringup (flutter/flutter#195862) 2026-11-04 [email protected] [web][a11y] Initialize slider semantics values when enabling (flutter/flutter#195564) 2026-11-04 [email protected] Drop Android SDK, JDK, and Gradle dependencies from framework_tests_misc (flutter/flutter#195869) 2026-11-04 [email protected] Roll Fuchsia Test Scripts from B6zarykZp6PKWRueg... to Jo-ZgQSNDuPsjlZ4s... (flutter/flutter#195937) 2026-11-04 [email protected] Balance tool_tests_commands and web_tool_tests subshards by duration (flutter/flutter#195863) 2026-11-04 [email protected] Roll Fuchsia Linux SDK from T_-6-6X1lDMghhAvX... to p0HDXLISPIElJfSz7... (flutter/flutter#195939) 2026-11-03 [email protected] Roll Skia from 3eeafac94f07 to 49ec2655bf51 (8 revisions) (flutter/flutter#195933) 2026-11-03 [email protected] Roll pub packages (flutter/flutter#195932) 2026-11-03 [email protected] [flutter_tools] Lazily initialize AppleContext dependencies via builder closures (flutter/flutter#191992) 2026-11-03 [email protected] [Android] Upgrade linux_android_emu_vulkan_stable avd_cipd_version to 36.1.9 (build_id:8670032186093418337) (flutter/flutter#195856) 2026-11-03 [email protected] [vulkan]: adds "color attachment read" dst dependency to subpass (flutter/flutter#195714) 2026-11-03 [email protected] [flutter_tools] Stream web dev server proxy responses instead of buffering them (flutter/flutter#194934) 2026-11-03 [email protected] Roll Skia from d80db8f8f856 to 3eeafac94f07 (6 revisions) (flutter/flutter#195926) 2026-11-03 [email protected] [flutter_tools] Add flutter assemble support for tool extension assemble targets (flutter/flutter#194563) 2026-11-03 [email protected] Manual roll Dart SDK from fe609902984b to e362a23e9738 (2 revisions) (flutter/flutter#195914) 2026-11-03 [email protected] feat(flutter_test): add startHover and startHoverAt helper to WidgetTester (flutter/flutter#190630) 2026-11-03 [email protected] [flutter_tools] Remove trailing dots from bug report URLs (flutter/flutter#194132) 2026-11-03 [email protected] Update skills_lint to 0.5.3 (flutter/flutter#195796) 2026-11-03 [email protected] Roll Skia from 58295d932350 to d80db8f8f856 (5 revisions) (flutter/flutter#195900) 2026-11-03 [email protected] [flutter_tools] Make DeviceLogReader.dispose asynchronous (flutter/flutter#195389) 2026-11-03 [email protected] Roll Packages from 3f34a6f to 1df8447 (10 revisions) (flutter/flutter#195895) 2026-11-03 [email protected] Roll Skia from c733ad3e37cb to 58295d932350 (1 revision) (flutter/flutter#195894) If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
When a
Slideris enabled after its semantics node already exists, the web engine attaches a newSemanticIncrementablerole to a node whosevalue,increasedValue, anddecreasedValuefields are not dirty._updateInputValues()then returns early on the role's firstupdate(), so the hidden<input type="range">is exposed to assistive technology withoutvalue,min,max,aria-valuetext,aria-valuenow,aria-valuemin, oraria-valuemax. The browser announces the default range value ("50") until the slider's value changes once.This change starts
_pendingResyncastrue, so a newly attached role performs one initial input-value sync on its firstupdate()— the approach proposed by @cashmula in the issue's "Likely cause" analysis, which also identified the root cause. The flag is cleared after that sync; its existing role inchange-event handling is unchanged.SemanticsNodeUpdatenormalizes absent value fields to empty strings, so the initial sync cannot hit null-asserts.Three regression tests are added to
test/engine/semantics/semantics_test.dart: enabling a previously disabled slider with unchanged values (the reported bug), disabling and re-enabling a slider (role reattachment resync), and role attachment while the engine is in pointer-events gesture mode (input stays disabled but attributes still sync).The first test fails on unmodified code: the input renders as bare
<input type="range" role="slider" tabindex="0">withvalue="50".Verified locally with
felton Windows against--gcs-prodartifacts matching the base revision:chrome-dart2js-canvaskit-engine, all 12test/engine/semanticsfiles: 280/280 tests passed.chrome-dart2wasm-canvaskit-engine,semantics_test.dart: all 191 tests passed.dart analyzeanddart formatclean on the changed files.Limitations: tested in Chrome with the CanvasKit renderer only (the engine test-set has no skwasm suite in
felt_config.yaml); Skia Gold screenshot checks were skipped locally; verified at the engine DOM level, not with a live screen reader. Upstream CI has not run yet.AI disclosure
The patch implementation and tests were prepared with assistance from Devin AI under human direction. I have independently reviewed the complete diff and understand the changes.
Fixes #195215
No changes to the flutter/tests repo were needed, so no migration guide applies.
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.