Skip to content

MACOS touch bar show password text #119824

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
theotruvelot opened this issue Feb 2, 2023 · 7 comments
Closed

MACOS touch bar show password text #119824

theotruvelot opened this issue Feb 2, 2023 · 7 comments
Assignees
Labels
a: desktop Running on desktop a: text input Entering text in a text field or keyboard related problems c: regression It was better in the past than it is now engine flutter/engine repository. See also e: labels. found in release: 3.7 Found to occur in 3.7 found in release: 3.8 Found to occur in 3.8 has reproducible steps The issue has been confirmed reproducible and is ready to work on P1 High-priority issues at the top of the work list platform-mac Building on or for macOS specifically r: fixed Issue is closed as already fixed in a newer version

Comments

@theotruvelot
Copy link

theotruvelot commented Feb 2, 2023

Hello, I'm writing a macOS app in flutter,
I make a password TextField, and in touch bar there is the password string.

my code :

final password = SizedBox(
      child: TextField(
        autocorrect: false,
        enableSuggestions: false,
        onSubmitted: (value) {
          if (emailController.text.isNotEmpty &&
              passwordController.text.isNotEmpty) {
            authBloc.add(
              LoginEvent(
                  email: emailController.text,
                  password: passwordController.text),
            );
          } else {
            ScaffoldMessenger.of(context).showSnackBar(
              SnackBar(
                backgroundColor: Constants.primaryColor,
                content: Text(
                  'Veuillez remplir tous les champs',
                  style: GoogleFonts.poppins(),
                ),
              ),
            );
          }
        },
        controller: passwordController,
        autofocus: false,
        obscureText: isObscure,
        decoration: InputDecoration(
          prefixIcon: const Icon(
            Icons.lock,
            color: Colors.grey,
            size: 20,
          ),
          suffixIcon: Padding(
            padding: const EdgeInsets.only(right: 8.0),
            child: IconButton(
              onPressed: () {
                setState(() {
                  isObscure = !isObscure;
                });
              },
              icon: isObscure
                  ? const Icon(Icons.visibility_off,
                      color: Colors.grey, size: 20)
                  : const Icon(Icons.visibility, color: Colors.grey, size: 20),
            ),
          ),
          hintText: 'Password',
          hintStyle: GoogleFonts.poppins(color: Colors.grey),
          contentPadding: const EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
          focusedBorder: OutlineInputBorder(
              borderRadius: BorderRadius.circular(32.0),
              borderSide:
                  const BorderSide(color: Constants.accentColor, width: 2)),
          border: OutlineInputBorder(
              borderRadius: BorderRadius.circular(32.0),
              borderSide:
                  const BorderSide(color: Constants.accentColor, width: 2)),
        ),
      ),
    );

My flutter doctor :
`theotruvelot@Paco-2 developpement/stocknet_client (develop !*%) » flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.0, on macOS 13.1 22C65 darwin-arm64, locale fr-FR)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.2.1)
[✓] VS Code (version 1.74.3)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

• No issues found!`

@huycozy huycozy added the in triage Presently being triaged by the triage team label Feb 3, 2023
@huycozy
Copy link
Member

huycozy commented Feb 3, 2023

@p2acoo Thanks for reporting this. This issue is reproducible on the latest stable and master channels with below minimal sample code.

Below is the demo when comparing Flutter app with macOS native app (using Secure Text Field view).

Flutter macOS native

Also, this seems to be a regression issue since it works as expected on Flutter 3.0.5.

stable 3.7.1 master 3.8.0-2.0.pre.43 3.3.10 3.0.5

✅: No Issue ❌: Issue reproduced

Sample code (minimal and complete)
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const Scaffold(
        body: Center(
          child: TextField(
            obscureText: true,
            enableSuggestions: false,
            autocorrect: false,
          ),
        ),
      ),
    );
  }
}
flutter doctor -v (stable and master)
[✓] Flutter (Channel stable, 3.7.1, on macOS 13.0.1 22A400 darwin-x64, locale en-VN)
    • Flutter version 3.7.1 on channel stable at /Users/huynq/Documents/GitHub/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7048ed95a5 (11 hours ago), 2023-02-01 09:07:31 -0800
    • Engine revision 800594f1f4
    • Dart version 2.19.1
    • DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/huynq/Library/Android/sdk
    • Platform android-33, build-tools 31.0.0
    • ANDROID_HOME = /Users/huynq/Library/Android/sdk
    • Java binary at: /Applications/Android Studio Dolphin 2021.3.1.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14B47b
    • CocoaPods version 1.11.3

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

[✓] Android Studio (version 2021.3)
    • Android Studio at /Applications/Android Studio Dolphin 2021.3.1.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 11.0.13+0-b1751.21-8125866)

[!] Android Studio (version 2022.1)
    • 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
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[✓] IntelliJ IDEA Community Edition (version 2022.1.1)
    • IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.app
    • 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

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

[✓] Connected device (4 available)
    • RMX2001 (mobile) • EUYTFEUSQSRGDA6D                         • android-arm64  • Android 11 (API 30)
    • iPhone (mobile)  • d9a94afe2b649fef56ba0bfeb052f0f2a7dae95e • ios            • iOS 15.7.2 19H218
    • macOS (desktop)  • macos                                    • darwin-x64     • macOS 13.0.1 22A400 darwin-x64
    • Chrome (web)     • chrome                                   • web-javascript • Google Chrome 109.0.5414.119

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.
[!] Flutter (Channel master, 3.8.0-2.0.pre.43, on macOS 13.0.1 22A400 darwin-x64, locale en-VN)
    • Flutter version 3.8.0-2.0.pre.43 on channel master at /Users/huynq/Documents/GitHub/flutter_master
    ! Warning: `flutter` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
    ! Warning: `dart` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 3570cce58e (64 minutes ago), 2023-02-03 04:34:17 +0300
    • Engine revision 2871970337
    • Dart version 3.0.0 (build 3.0.0-196.0.dev)
    • DevTools version 2.21.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 31.0.0)
    • Android SDK at /Users/huynq/Library/Android/sdk
    • Platform android-33, build-tools 31.0.0
    • ANDROID_HOME = /Users/huynq/Library/Android/sdk
    • Java binary at: /Users/huynq/Library/Java/JavaVirtualMachines/corretto-1.8.0_302/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment Corretto-8.302.08.1 (build 1.8.0_302-b08)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14B47b
    • CocoaPods version 1.11.3

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

[!] Android Studio (version 2022.1)
    • 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
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[✓] IntelliJ IDEA Community Edition (version 2022.1.1)
    • IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.app
    • 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

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

[✓] Connected device (3 available)
    • RMX2001 (mobile) • EUYTFEUSQSRGDA6D • android-arm64  • Android 11 (API 30)
    • macOS (desktop)  • macos            • darwin-x64     • macOS 13.0.1 22A400 darwin-x64
    • Chrome (web)     • chrome           • web-javascript • Google Chrome 109.0.5414.119

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 2 categories.

@huycozy huycozy added a: text input Entering text in a text field or keyboard related problems c: regression It was better in the past than it is now engine flutter/engine repository. See also e: labels. platform-mac Building on or for macOS specifically has reproducible steps The issue has been confirmed reproducible and is ready to work on found in release: 3.7 Found to occur in 3.7 found in release: 3.8 Found to occur in 3.8 a: desktop Running on desktop and removed in triage Presently being triaged by the triage team labels Feb 3, 2023
@bleroux
Copy link
Contributor

bleroux commented Feb 3, 2023

I bisected this regression to flutter commit #106162
It is probably related to flutter/engine#33827

@knopp
It seems that putting the FlutterTextInputPlugin in the view hierarchy automatically create a link with the Mac Touch Bar.
Maybe there is a way to desactivate this link based on the TextField configuration?

@cbracken cbracken self-assigned this Feb 3, 2023
@cbracken cbracken added the P1 High-priority issues at the top of the work list label Feb 3, 2023
@cbracken
Copy link
Member

cbracken commented Feb 3, 2023

Yikes. Thanks for filing. @knopp's patch didn't introduce the bug so much as it revealed the existing bug. Nice catch. I'll get a fix out!

@knopp
Copy link
Member

knopp commented Feb 3, 2023

Completely missed this. Even before the PR FlutterTextInputPlugin was in view hierarchy when accessibility was enabled so I assume it would still cause the issue.

@bleroux
Copy link
Contributor

bleroux commented Feb 3, 2023

@knopp
The issue is not reproducible before flutter/engine#33827 but I agree with @cbracken that your great PR "didn't introduce the bug so much as it revealed the existing bug".

Before your PR, the Touch Bar did not show anything when using a non-obscured TextField such as:

  child: TextField(
    obscureText: false,
    enableSuggestions: true,
    autocorrect: true,
  )

AFAIK, your PR added support for the Touch Bar.
Maybe next step is that 'enableSuggestions: false' would disconnect the Touch Bar?

@cbracken
Copy link
Member

cbracken commented Feb 7, 2023

I've got a patch that applies the fix and have verified it works. Currently banging up a test for it that covers both the top-level obscureText attribute as well as when applied to any associated autofill-field-level attributes.

cbracken added a commit to cbracken/flutter_engine that referenced this issue Feb 7, 2023
By default, autocomplete is enabled during text input on macOS. On Macs
with the touchbar enabled, the current text input and any suggested
autocompletions are listed in the touchbar.

This adds support for disabling autocomplete when obscureText is set in
the text input configuration, or if the autofill hint type is
"password", "username", or the empty string. When an AutofillGroup is in
use, we disable autocomplete for all fields within the group when any of
the fields disables autocomplete.

While OS-level autocomplete support is far more robust on iOS, this
behaviour matches out enable/disable state management behaviour on that
platform.

Issue: flutter/flutter#119824
cbracken added a commit to cbracken/flutter_engine that referenced this issue Feb 7, 2023
By default, autocomplete is enabled during text input on macOS. On Macs
with the touchbar enabled, the current text input and any suggested
autocompletions are listed in the touchbar.

This adds support for disabling autocomplete when obscureText is set in
the text input configuration, or if the autofill hint type is
"password", "username", or the empty string. When an AutofillGroup is in
use, we disable autocomplete for all fields within the group when any of
the fields disables autocomplete.

While OS-level autocomplete support is far more robust on iOS, this
behaviour matches out enable/disable state management behaviour on that
platform.

Issue: flutter/flutter#119824
cbracken added a commit to cbracken/flutter_engine that referenced this issue Feb 7, 2023
By default, autocomplete is enabled during text input on macOS. On Macs
with the touchbar enabled, the current text input and any suggested
autocompletions are listed in the touchbar.

This adds support for disabling autocomplete when obscureText is set in
the text input configuration, or if the autofill hint type is
"password", "username", or the empty string. When an AutofillGroup is in
use, we disable autocomplete for all fields within the group when any of
the fields disables autocomplete.

While OS-level autocomplete support is far more robust on iOS, this
behaviour matches out enable/disable state management behaviour on that
platform.

Issue: flutter/flutter#119824
cbracken added a commit to cbracken/flutter_engine that referenced this issue Feb 7, 2023
By default, autocomplete is enabled during text input on macOS. On Macs
with the touchbar enabled, the current text input and any suggested
autocompletions are listed in the touchbar.

This adds support for disabling autocomplete when autocorrect is
disabled, when obscureText is set in the text input configuration, and
when the autofill hint type is "password" or "username". When an
AutofillGroup is in use, we disable autocomplete for all fields within
the group when any of the fields disables autocomplete.

While OS-level autocomplete support is far more robust on iOS, this
behaviour matches our enable/disable state management behaviour on that
platform.

Issue: flutter/flutter#119824
cbracken added a commit to cbracken/flutter_engine that referenced this issue Feb 7, 2023
By default, autocomplete is enabled during text input on macOS. On Macs
with the touchbar enabled, the current text input and any suggested
autocompletions are listed in the touchbar.

This adds support for disabling autocomplete when autocorrect is
disabled, when obscureText is set in the text input configuration, and
when the autofill hint type is "password" or "username". When an
AutofillGroup is in use, we disable autocomplete for all fields within
the group when any of the fields disables autocomplete.

While OS-level autocomplete support is far more robust on iOS, this
behaviour matches our enable/disable state management behaviour on that
platform.

Issue: flutter/flutter#119824
cbracken added a commit to cbracken/flutter_engine that referenced this issue Feb 8, 2023
By default, autocomplete is enabled during text input on macOS. On Macs
with the touchbar enabled, the current text input and any suggested
autocompletions are listed in the touchbar.

This adds support for disabling autocomplete when autocorrect is
disabled, when obscureText is set in the text input configuration, and
when the autofill hint type is "password" or "username". When an
AutofillGroup is in use, we disable autocomplete for all fields within
the group when any of the fields disables autocomplete.

While OS-level autocomplete support is far more robust on iOS, this
behaviour matches our enable/disable state management behaviour on that
platform.

Issue: flutter/flutter#119824
cbracken added a commit to cbracken/flutter_engine that referenced this issue Feb 8, 2023
By default, autocomplete is enabled during text input on macOS. On Macs
with the touchbar enabled, the current text input and any suggested
autocompletions are listed in the touchbar.

This adds support for disabling autocomplete when autofill is disabled,
when obscureText is set in the text input configuration, and when the
autofill hint type is "password" or "username". When an AutofillGroup is
in use, we disable autocomplete for all fields within the group when any
of the fields disables autocomplete.

While OS-level autocomplete support is far more robust on iOS, this
behaviour matches our enable/disable state management behaviour on that
platform.

Issue: flutter/flutter#119824
cbracken added a commit to cbracken/flutter_engine that referenced this issue Feb 8, 2023
By default, autocomplete is enabled during text input on macOS. On Macs
with the touchbar enabled, the current text input and any suggested
autocompletions are listed in the touchbar.

This adds support for disabling autocomplete when autofill is disabled,
when obscureText is set in the text input configuration, and when the
autofill hint type is "password" or "username". When an AutofillGroup is
in use, we disable autocomplete for all fields within the group when any
of the fields disables autocomplete.

While OS-level autocomplete support is far more robust on iOS, this
behaviour matches our enable/disable state management behaviour on that
platform.

Issue: flutter/flutter#119824
cbracken added a commit to flutter/engine that referenced this issue Feb 8, 2023
By default, autocomplete is enabled during text input on macOS. On Macs
with the touchbar enabled, the current text input and any suggested
autocompletions are listed in the touchbar.

This adds support for disabling autocomplete when autofill is disabled,
when obscureText is set in the text input configuration, and when the
autofill hint type is "password" or "username". When an AutofillGroup is
in use, we disable autocomplete for all fields within the group when any
of the fields disables autocomplete.

While OS-level autocomplete support is far more robust on iOS, this
behaviour matches our enable/disable state management behaviour on that
platform.

Issue: flutter/flutter#119824
@cbracken cbracken closed this as completed Feb 8, 2023
@huycozy huycozy added the r: fixed Issue is closed as already fixed in a newer version label Feb 10, 2023
@github-actions
Copy link

github-actions bot commented Mar 3, 2023

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: desktop Running on desktop a: text input Entering text in a text field or keyboard related problems c: regression It was better in the past than it is now engine flutter/engine repository. See also e: labels. found in release: 3.7 Found to occur in 3.7 found in release: 3.8 Found to occur in 3.8 has reproducible steps The issue has been confirmed reproducible and is ready to work on P1 High-priority issues at the top of the work list platform-mac Building on or for macOS specifically r: fixed Issue is closed as already fixed in a newer version
Projects
None yet
Development

No branches or pull requests

5 participants