Conversation
There was a problem hiding this comment.
Pull request overview
Updates the web NativeViewGestureHandler to activate immediately for TextInput-like controls (to better match native behavior) and refactors control-role detection into a single controlType classification.
Changes:
- Add
ControlTypeenum and replacebuttonRole/switchRoleflags withcontrolType. - Activate the native view gesture immediately for detected text inputs on web (
input/textarea). - Update downstream role checks (
activate/move/isButton) to usecontrolType.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Updates the web implementation of NativeViewGestureHandler so that TextInput-like controls can activate immediately (aligning callback timing with native platforms), while also refactoring control-role tracking into a single typed field.
Changes:
- Introduce a
ControlTypeenum and replacebuttonRole/switchRoleflags with a singlecontrolType. - Classify the underlying DOM element as
Button,Switch,TextInput, orOtherduringinit(). - Update activation and pointer-move logic to use
controlType, including immediate activation for detected text inputs.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (view.getAttribute('role') === 'button') { | ||
| this.controlType = ControlType.Button; | ||
| } else if (view.querySelector('input[role="switch"]') !== null) { | ||
| this.controlType = ControlType.Switch; | ||
| } else if (view.matches('input:not([role]):not([type]), textarea')) { | ||
| this.controlType = ControlType.TextInput; | ||
| } else { |
There was a problem hiding this comment.
I don't think think we need this, at least for now. Maybe we can add it in the future if it's necessary.
There was a problem hiding this comment.
Input type will be used often since it changes what type of keyboard is shown on mobile.
There was a problem hiding this comment.
Okay, you've got a point. But in that case, do we want to consider only text inputs, or also others, like number? I could be biased since this PR was specifically about TextInput, but now I'm not sure which behavior is correct.
Also if we want other types to activate on start, I think that TextInput role doesn't fit anymore, maybe just Input would be better.
There was a problem hiding this comment.
I mean, it doesn't really make sense for an email input to behave differently from a number input in this context.
I think that TextInput role doesn't fit anymore, maybe just Input would be better.
Why not? It's still TextInput component underneath, and when filtering over type we'd want the ones that result in a text input anyway.
Caution
Similarly as
iOSversion, this will be blocked for now.Description
To match native platforms behavior,
TextInputshould activate immediately on web. This PR also extracts type of underlying view into separate variable.Test plan
Tested on the following code: