Skip to content

Android IME keyboards not working with DatePicker/RangePicker due to keydown handlingΒ #929

@jfernandezpe

Description

@jfernandezpe

Hi there,

I'm using Antd Date Picker and Range Picker, and I'm facing an issue: I can't use virtual keyboards (Input Method Editors or IMEs) on my Android device because the browser is not passing the actual pressed key to JavaScript. If you listen to the native HTML keydown event, the event.key is Unidentified.

This article describes a similar issue quite well: https://weiyen.net/articles/an-unusual-google-keyboard-bug/. However, I've been researching a bit more and it seems to be related to several virtual keyboards, including GBoard and Microsoft SwiftKey.

I found some issues in Chromium, but unfortunately, it looks like they don't plan to fix this, since it rely on how virtual keyboards work for getting that info:

A possible workaround seems to be handling validation and formatting by listening to the input event instead of keydown. So the problem might be in the function onFormatKeyDown, which could still handle special keys like Enter, Escape, etc., and move validation and committing changes to a new input handler.

What do you think about it?

Best regards,
Jose

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions