Skip to content

On web platforms, I want to receive a key event via RawKeyboardListener #52656

Closed

Description

@cjng96

Use case

I need to receive a key event to customize some action on edit control.
On web platform, a key event does not occur. :(
(It's working well with RawKeyListener on Android platform)

I need RawKeyListener on EditableText for the following use-case,

  1. Support short-cut key on edit control for several case
    (1) Popup dialog for recommanded text list,
    (2) Reset to default text status,
    (3) Change input dialog layout(normal user or expert user)
  2. I want to implement powerful rich editor based on flutter. so I need text editing service and keyEvent from Engine.

Proposal

After some investigating, I found it's intented operation by the engine's pull-reqest #13699.

I think it's better that the engine send the key event and the key event is ignored on editable.dart / RenderEdtiable / _handleKeyEvent function like following,

    final bool isWeb = keyEvent.data is RawKeyEventDataWeb;
    if (isWeb) {
      // On web platforms, The key should be ignored because the cursor has already moved
      return;
    }

It solves original #44133 issue and I can receive key events on the Web, such as Android platform.

I modified engine and flutter code and it's working well now as expected.(RawKeyListener with EditableText is working well and duplicated keyboard action on input conttol on web doesn't occur)

I am going to make two pull-requests for it. :)

  1. flutter engine / keyboard.dart
    No ignore key event on input control on web platform

  2. flutter / editable.dart
    Ignore keyEvent from Web.

Activity

  1. added
    c: proposalA detailed proposal for a change to Flutter
    platform-webWeb applications specifically
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Mar 16, 2020
  2. yjbanov commented on Mar 19, 2020

    @yjbanov
    Contributor

    /cc @mdebbar can you please triage and look at the PRs?

  3. yjbanov commented on Mar 25, 2020

    @yjbanov
    Contributor

    /cc @mariamhas this issue came up again in our conversation today.

  4. added this to the April 2020 milestone on Mar 26, 2020
  5. mdebbar commented on Apr 1, 2020

    @mdebbar
    Contributor

    Framework and engine PRs were merged (#52661 and flutter-team-archive/engine#17242).

  6. lock commented on Apr 25, 2020

    @lock

    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.

  7. locked and limited conversation to collaborators on Apr 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.platform-webWeb applications specifically

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions