Skip to content

Keyboard events should be implemented on iOS #31945

Closed

Description

@gspencergoog

RawKeyboardListener works for Android and other platforms, but not on iOS, because it isn't implemented in the engine

See also #2601, and discussion on flutter-team-archive/engine#8606

Activity

  1. added
    a: text inputEntering text in a text field or keyboard related problems
    engineflutter/engine related. See also e: labels.
    on May 2, 2019
  2. added
    platform-iosiOS applications specifically
    and removed on Aug 13, 2019
  3. lynn commented on Oct 4, 2019

    @lynn

    discussion on #8606

    Since I was confused here: that's #8606 on flutter/engine, not this repo.


    It seems there is more blocking this than the simple matter of implementing it in the engine.

    I gather that iOS does not actually expose key-level events in its public API. Flutter would only have "insertText" and "deleteBackward" and "UIKeyCommand" events to work with, and mapping those back to the USB keypresses that generated them is not feasible.

    Maybe the situation is different on iOS 13 (but probably not by much). At the very least, from the comments on this WebKit bug, it sounds like a best-effort implementation could handle e.g. arrow keys on iOS 13, but not earlier versions. I certainly don't see the full picture of how close to an implementation of RawKeyboardEvent for iOS it's possible to get, but it seems the answer is "not very close". (I see no way to detect keydown vs. keyup, for example, as one might need for e.g. games that use WASD keys for movement.)

  4. changed the title [-]Raw Keyboard Events should be implemented on iOS[/-] [+]Keyboard events should be implemented on iOS[/+] on Mar 19, 2020
  5. jmagman commented on Mar 19, 2020

    @jmagman
    Member

    iPadOS 13.4 (March 24 release) emphasized magic keyboard/trackpad support for 2018 iPad Pro, more users may be hitting this.

  6. kaarme01 commented on Apr 27, 2020

    @kaarme01

    discussion on #8606

    Since I was confused here: that's #8606 on flutter/engine, not this repo.

    It seems there is more blocking this than the simple matter of implementing it in the engine.

    I gather that iOS does not actually expose key-level events in its public API. Flutter would only have "insertText" and "deleteBackward" and "UIKeyCommand" events to work with, and mapping those back to the USB keypresses that generated them is not feasible.

    Maybe the situation is different on iOS 13 (but probably not by much). At the very least, from the comments on this WebKit bug, it sounds like a best-effort implementation could handle e.g. arrow keys on iOS 13, but not earlier versions. I certainly don't see the full picture of how close to an implementation of RawKeyboardEvent for iOS it's possible to get, but it seems the answer is "not very close". (I see no way to detect keydown vs. keyup, for example, as one might need for e.g. games that use WASD keys for movement.)

    https://developer.apple.com/documentation/uikit/mac_catalyst/handling_key_presses_made_on_a_physical_keyboard
    ?

  7. dgurudot commented on Jun 9, 2020

    @dgurudot

    Any updates on it ? iOS allows external bluetooth keyboard to be connected so is it possible to detect keyboard key presses ?

    One of my app needs to detect shortcuts like Shift+1, or Ctrl-Z etc and looking for solutions.

  8. nilsreichardt commented on Jun 27, 2020

    @nilsreichardt
    Contributor

    Is macOS also effected from this issue?

  9. gspencergoog commented on Jun 28, 2020

    @gspencergoog
    ContributorAuthor

    No, macOS has keyboard support.

  10. incon commented on Aug 19, 2020

    @incon
    Contributor
  11. lynn commented on Aug 19, 2020

    @lynn

    Yes, we have solved this with a platform channel and UIKey in our project.

  12. added
    P2Important issues not at the top of the work list
    on Aug 26, 2020
  13. github-actions commented on Aug 10, 2021

    @github-actions

    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.

  14. locked as resolved and limited conversation to collaborators on Aug 10, 2021
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

    P2Important issues not at the top of the work lista: desktopRunning on desktopa: text inputEntering text in a text field or keyboard related problemsc: new featureNothing broken; request for a new capabilityengineflutter/engine related. See also e: labels.platform-iosiOS applications specifically

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions