-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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] Fix section clearing behavior on Android #13652
[fields] Fix section clearing behavior on Android #13652
Conversation
Deploy preview: https://deploy-preview-13652--material-ui-x.netlify.app/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's improves the current behavior, I think we can ship it
Is the behavior better / worse in v7 approach?
(inputRef.current.selectionStart !== selectionStart || | ||
inputRef.current.selectionEnd !== selectionEnd) | ||
) { | ||
interactions.syncSelectionToDOM(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid of a possible endless recursion here. 🤔
WDYT, do we need an additional safeguard against it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have a clearer idea of a scenario when this recursion might happen?
Tbh I don't really know how to add safeguards here 😬
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't think of any. 🤔
It's better on |
Fixes #13620
Related to #10399.
The present behavior and test for section clearing on Android seemed incorrect.
It doesn't work like that on Desktop.
The change aligns the section clearing behavior between Desktop and Android.
There is still an issue on Chrome on Android with syncing the focus on a section, which has a different length placeholder than the value (i.e. full length month).screen-20240628-160431.2.mp4
Maybe because it requires an extra repaint/resize cycle. 🤷If you have ideas on how to solve it—I'm all ears.
P.S. Wrapping the
syncSelectionToDOM
call in asetTimeout
fixes the issue, but introduces a delay and causes the caret to be momentarily visible.P.P.S. The situation with the MS Swiftkey keyboard is even worse... All the section selections are no syncked after section removal. 🙈
This fix seems to avoid the problem and works stable: 73ed8e9 (albeit with a slight chance of endless recursion in an unforeseen case).
In any case, I'd be happy to ship this fix as is, because the current state of Chrome on Android with Gboard is pretty bad-unusable when deleting. 🙈