Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Modifier keys state should also be synchronized based on pointer events #115066

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
4 tasks done
bleroux opened this issue Nov 10, 2022 · 1 comment
Closed
4 tasks done
Assignees
Labels
a: desktop Running on desktop a: text input Entering text in a text field or keyboard related problems engine flutter/engine repository. See also e: labels. P2 Important issues not at the top of the work list platform-web Web applications specifically r: fixed Issue is closed as already fixed in a newer version

Comments

@bleroux
Copy link
Contributor

bleroux commented Nov 10, 2022

On Desktop and Web, Flutter maintains keyboard state based on key events received when the window has focus.
If a keyboard event happens when the window has lost focus, Flutter keyboard state is not updated.
This leads to visible bugs, especially ones related to modifier keys. See #112488

Steps to Reproduce

  1. Launch the below code sample.
  2. Enter some test in the text field.
  3. Click somewhere on the text.
  4. Hold shift key pressed.
  5. While holding the shift key, click somewhere else on the text, the text between both click positions is selected.
  6. While holding the shift key, click on another window (Flutter window loses focus).
  7. Release the shift key.
  8. Click inside the text field.

Expected results: At step 8, the click should just move the cursor and no text should be selected

Actual results: At step 8, the click updates the selection (as the shift key was still pressed).

Code sample
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Container(
          alignment: Alignment.center,
          padding: const EdgeInsets.all(16),
          child: const TextField(),
        ),
      ),
    );
  }
}

As per this discussion, the modifier keys states should be also updated based on pointer events (which contain a modifier state property).

This should be implemented on the engine side for:

@bleroux bleroux added in triage Presently being triaged by the triage team a: text input Entering text in a text field or keyboard related problems engine flutter/engine repository. See also e: labels. platform-web Web applications specifically a: desktop Running on desktop and removed in triage Presently being triaged by the triage team labels Nov 10, 2022
@bleroux bleroux self-assigned this Nov 10, 2022
@bleroux bleroux moved this from To do to In progress in Nevercode Nov 10, 2022
@bleroux bleroux moved this to To do in Nevercode Nov 10, 2022
@gspencergoog gspencergoog added the P2 Important issues not at the top of the work list label Nov 10, 2022
@bleroux bleroux moved this from In progress to PR submitted in Nevercode Jan 17, 2023
@bleroux bleroux closed this as completed Jan 20, 2023
@github-project-automation github-project-automation bot moved this from PR submitted to Done (PR merged) in Nevercode Jan 20, 2023
@bleroux bleroux added the r: fixed Issue is closed as already fixed in a newer version label Jan 20, 2023
@github-actions
Copy link

github-actions bot commented Mar 4, 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 4, 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 engine flutter/engine repository. See also e: labels. P2 Important issues not at the top of the work list platform-web Web applications specifically r: fixed Issue is closed as already fixed in a newer version
Projects
Status: Done (PR merged)
Development

No branches or pull requests

2 participants