Skip to content
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

[fields] Can't press Backspace on Android #7835

Closed
2 tasks done
flaviendelangle opened this issue Feb 6, 2023 · 0 comments · Fixed by #7842
Closed
2 tasks done

[fields] Can't press Backspace on Android #7835

flaviendelangle opened this issue Feb 6, 2023 · 0 comments · Fixed by #7842
Assignees
Labels
bug 🐛 Something doesn't work component: pickers This is the name of the generic UI component, not the React module! feature: Keyboard editing Related to the pickers keyboard edition

Comments

@flaviendelangle
Copy link
Member

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Steps to reproduce 🕹

Link to live example:

Steps:

  1. Take any Android device
  2. Go to https://next.mui.com/x/react-date-pickers/date-field/#customize-the-date-format
  3. Select the month section
  4. Press the Backspace key

Current behavior 😯

It should clean the section without adding the placeholder back

Screen.Recording.2023-02-05.at.22.09.16.mov

Expected behavior 🤔

It should render MM

Context 🔦

The Backspace logic is applied by the onKeyDown event handler which does not work on Android.
We should move it on the onChange event handler.

But to support Android it will be harder.
Indeed, on Android, we usually have 2 calls to onChange : one removing the selecting value and then one applying the key pressed to the previously selected area (see the JSDoc of tempValueStrAndroid in our codebase for more details).
When pressing Backspace, this callback is only called once.

During the 1st call to onChange, we can't differentiate if the selected value is cleaned because Backspace has been pressed or just to prepare for the insertion of another value.
The only was I see is to put a setTimeout saying that if after Xms the onChange was not called again, then we apply the placeholder.
There will probably be a flickering but I don't have a better solution.

Your environment 🌎

No response

Order ID 💳 (optional)

No response

@flaviendelangle flaviendelangle added bug 🐛 Something doesn't work component: pickers This is the name of the generic UI component, not the React module! feature: Keyboard editing Related to the pickers keyboard edition labels Feb 6, 2023
@flaviendelangle flaviendelangle self-assigned this Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: pickers This is the name of the generic UI component, not the React module! feature: Keyboard editing Related to the pickers keyboard edition
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant