Skip to content

SemanticsNode.updateWith does not mark node as dirty when only role changes. #162577

@ksokolovskyi

Description

@ksokolovskyi

Steps to reproduce

Run the code sample below.

Expected results

SemanticsNode is marked as dirty after role was changed.

Actual results

SemanticsNode is not marked as dirty after role was changed.

Code sample

Code sample
test('', () {
  final SemanticsOwner owner = SemanticsOwner(onSemanticsUpdate: (_) {});
  addTearDown(owner.dispose);

  final SemanticsNode node = SemanticsNode();
  node.attach(owner);

  expect(node.role, SemanticsRole.none);

  final SemanticsConfiguration config = SemanticsConfiguration()..role = SemanticsRole.tab;
  node.updateWith(config: config);

  final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder();
  node.debugFillProperties(builder);

  expect(node.role, config.role);
  expect(builder.properties.toString(), contains('dirty'));
});

Flutter Doctor output

Doctor output
[✓] Flutter (Channel master, 3.29.0-1.0.pre.208, on macOS 15.2 24C101 darwin-arm64, locale en-US) [2.2s]
    • Flutter version 3.29.0-1.0.pre.208 on channel master at /Users/ksokolovskyi/development/flutter_master
    • Upstream repository git@github.com:flutter/flutter.git
    • FLUTTER_GIT_URL = git@github.com:ksokolovskyi/flutter.git
    • Framework revision 4d08217f8d (16 hours ago), 2025-02-01 14:43:34 -0800
    • Engine revision 4d08217f8d
    • Dart version 3.8.0 (build 3.8.0-24.0.dev)
    • DevTools version 2.42.0

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [1,857ms]
    • Android SDK at /Users/ksokolovskyi/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/ksokolovskyi/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)
    • All Android licenses accepted.

[!] Xcode - develop for iOS and macOS (Xcode 16.2) [779ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16C5032a
    ! CocoaPods 1.14.3 out of date (1.16.2 is recommended).
        CocoaPods is a package manager for iOS or macOS platform code.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/to/platform-plugins
      To update CocoaPods, see https://guides.cocoapods.org/using/getting-started.html#updating-cocoapods

[✓] Chrome - develop for the web [10ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.2) [9ms]
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)

[✓] VS Code (version 1.96.4) [8ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.102.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)a: tests"flutter test", flutter_test, or one of our teststeam-accessibilityOwned by Framework Accessibility team (i.e. responsible for accessibility code in flutter/flutter)triaged-accessibilityTriaged by Framework Accessibility team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions