[web][a11y] Initialize slider semantics values when enabling (#195564) <!-- Thanks for filing a pull request! Reviewers are typically assigned within a week of filing a request. To learn more about code review, see our documentation on Tree Hygiene: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md --> 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 ("50") until the slider's value changes once. This change starts `_pendingResync` as `true`, so a newly attached role performs one initial input-value sync on its first `update()` — 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 in `change`-event handling is unchanged. `SemanticsNodeUpdate` normalizes 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">` with `value="50"`. Verified locally with `felt` on Windows against `--gcs-prod` artifacts matching the base revision: - `chrome-dart2js-canvaskit-engine`, all 12 `test/engine/semantics` files: 280/280 tests passed. - `chrome-dart2wasm-canvaskit-engine`, `semantics_test.dart`: all 191 tests passed. - `dart analyze` and `dart format` clean 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 https://github.com/flutter/flutter/issues/195215 No changes to the [flutter/tests] repo were needed, so no migration guide applies. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant in-code documentation (doc comments with `///`). - [x] If this PR introduces a new feature or capability, I created and linked a website documentation issue or PR in [flutter/website] (or verified none is needed). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing. 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](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot 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. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/CONTRIBUTING.ai.md [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [flutter/website]: https://github.com/flutter/website [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md Co-authored-by: NemesisDevX <nemesisdevx@users.noreply.github.com> Co-authored-by: zhongliugo <zhongliu88889@gmail.com>
Flutter is Google's SDK for crafting beautiful, fast user experiences for mobile, web, and desktop from a single codebase. Flutter works with existing code, is used by developers and organizations around the world, and is free and open source.
For release and other announcements, join the flutter-announce mailing list. Our documentation also tracks breaking changes across releases.
The Flutter tool may occasionally download resources from Google servers. By downloading or using the Flutter SDK, you agree to the Google Terms of Service: https://policies.google.com/terms
For example, when installed from GitHub (as opposed to from a prepackaged archive), the Flutter tool will download the Dart SDK from Google servers immediately when first run, as it is used to execute the flutter tool itself. This will also occur when Flutter is upgraded (e.g. by running the flutter upgrade command).
We think Flutter will help you create beautiful, fast apps, with a productive, extensible and open development model, whether you're targeting iOS or Android, web, Windows, macOS, Linux or embedding it as the UI toolkit for a platform of your choice.
We want to enable designers to deliver their full creative vision without being forced to water it down due to limitations of the underlying framework. Flutter‘s layered architecture gives you control over every pixel on the screen and its powerful compositing capabilities let you overlay and animate graphics, video, text, and controls without limitation. Flutter includes a full set of widgets that deliver pixel-perfect experiences whether you’re building for iOS (Cupertino) or other platforms (Material), along with support for customizing or creating entirely new visual components.
Flutter is fast. It's powered by hardware-accelerated 2D graphics libraries like Skia (which underpins Chrome and Android) and Impeller. We architected Flutter to support glitch-free, jank-free graphics at the native speed of your device.
Flutter code is powered by the world-class Dart programming language, which enables compilation to 32-bit and 64-bit ARM machine code for iOS and Android, JavaScript and WebAssembly for the web, as well as Intel x64 and ARM for desktop devices.
Flutter offers stateful hot reload, allowing you to make changes to your code and see the results instantly without restarting your app or losing its state.
Flutter works with any development tool (or none at all), and also includes editor plug-ins for both Visual Studio Code and IntelliJ / Android Studio. Flutter provides tens of thousands of packages to speed your development, regardless of your target platform. And accessing other native code is easy, with support for both FFI (on Android, on iOS, on macOS, on Linux, and on Windows) as well as platform-specific APIs.
Flutter is a fully open-source project, and we welcome contributions. Information on how to get started can be found in our contributor guide.