Skip to content

With EnsureSemantics on, Buttons Maintain Focus State on Press #158527

@emma-roudabush-disney

Description

@emma-roudabush-disney

Steps to reproduce

On flutter beta version 3.27.0-0.1.pre

  1. Turn on semantics auto rendering for application
  2. Have an app with a button that doesn't result in navigation
  3. Launch on web
  4. Press button

Expected results

Focus state and visual should only be showing on keyboard navigation (i.e. tab)

Actual results

If you press a button/interactive component (that doesn't navigate), after release, the button will both have focus and show focus visual. If autorendering of semantics is disabled, then this issue doesn't happen.

Code sample

With favorites sample

Code sample
  Widget build(BuildContext context) {
    SemanticsBinding.instance.ensureSemantics();
    return ChangeNotifierProvider<Favorites>(
      create: (context) => Favorites(),
      child: MaterialApp.router(
        title: 'Testing Sample',
        theme: ThemeData(
          colorSchemeSeed: Colors.blue,
          visualDensity: VisualDensity.adaptivePlatformDensity,
        ),
        routerConfig: router(),
      ),
    );
  }

Screenshots or Video

Screenshots / Video demonstration
Screen.Recording.2024-11-12.at.12.21.49.PM.mov

Logs

No response

Flutter Doctor output

Doctor output
Flutter 3.27.0-0.1.pre • channel beta •
https://emma-roudabush-disney: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@github.com
/flutter/flutter.git
Framework • revision 2e2c358c9b (3 weeks ago) • 2024-10-22 11:02:13 -0400
Engine • revision af0f0d559c
Tools • Dart 3.6.0 (build 3.6.0-334.3.beta) • DevTools 2.40.1
emmaroudabush@V17CNW73XQ sandbox % flutter doctor -v
[!] Flutter (Channel beta, 3.27.0-0.1.pre, on macOS 14.5 23F79 darwin-arm64,
    locale en-US)
    • Flutter version 3.27.0-0.1.pre on channel beta at
      /Users/emmaroudabush/Source/flutter
    ! Upstream repository
      https://emma-roudabush-disney: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@gith
      ub.com/flutter/flutter.git is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to
      https://emma-roudabush-disney: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@gith
      ub.com/flutter/flutter.git to dismiss this error.
    • Framework revision 2e2c358c9b (3 weeks ago), 2024-10-22 11:02:13 -0400
    • Engine revision af0f0d559c
    • Dart version 3.6.0 (build 3.6.0-334.3.beta)
    • DevTools version 2.40.1
    • If those were intentional, you can disregard the above warnings; however it
      is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version
    32.1.0-rc1)
    • Android SDK at /Users/emmaroudabush/Library/Android/sdk
    • Platform android-34, build-tools 32.1.0-rc1
    • Java binary at: /Applications/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      17.0.10+0-17.0.10b1087.21-11572160)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Users/emmaroudabush/Downloads/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.15.2

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

[✓] Android Studio (version 2023.3)
    • 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
      17.0.10+0-17.0.10b1087.21-11572160)

[✓] VS Code (version 1.95.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.100.0

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listc: regressionIt was better in the past than it is nowcustomer: castawayfound in release: 3.27Found to occur in 3.27frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-webOwned by Web platform teamtriaged-webTriaged by Web platform team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions