Writing flow: Fix focus trap on non-text input
types
#32714
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #32712
Description
Some existing logic to handle keydown events on
input
elements does not completely account for the fact that a lot of input types do not support selection ranges, which means we can't always assume they are "text fields".This PR addresses the most serious problem caused by this naive handling, which is a focus trap on non-text inputs.
The downside to the simple fix in this PR is that up/down arrow keydowns will no longer trigger the native behavior for input types like
number
. I think this is a reasonable trade-off though, since a keyboard user has alternative ways to modify anumber
input but no way out of the focus trap. Smarter handling of variousinput
types will require a more complex system, since they each react to arrow keys in different ways.The rest of the user-facing issues caused by naive
input
handling seem to be less serious, and merely inconveniences, e.g. #32713 and #32715.How has this been tested?
color
andfile
).Screenshots
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist:
*.native.js
files for terms that need renaming or removal).