react-native-web icon indicating copy to clipboard operation
react-native-web copied to clipboard

Allow `.focus()` to take standard options. (`preventScroll`, `focusVisible`)

Open Jackman3005 opened this issue 3 years ago • 4 comments

Is there an existing request?

  • [X] I have searched for this request

Describe the feature request

Reason for Feature Request

When focusing a text input on Safari, it will automatically scroll to the text input. If there is already an animated scroll in progress, the Safari scroll will interrupt the in-progress scroll and scroll to the text input.

The workaround appears to be to call focus like this: textInput.focus({preventScroll: true}). This however, does not seem to have any effect.

Research

With my limited knowledge, I investigated the focus call through react-native code and it appeared that any arguments provided would not be passed on to the focus event that is emitted.

Expectation

When calling textInput.focus({preventScroll:true}); that the options argument provided to .focus(options) is passed along to the browser for handling as per standard focus specification.

Jackman3005 avatar Mar 02 '23 00:03 Jackman3005

:warning: This issue is missing required fields. To avoid this issue being closed, please provide the required information as described in the ISSUE TEMPLATE.

github-actions[bot] avatar Mar 20 '23 18:03 github-actions[bot]

This should have been reported as a bug an included a reproducible test case

necolas avatar Mar 20 '23 18:03 necolas

The ISSUE TEMPLATE link above is broken. Our scenario was somewhat tightly tied to our implementation, so it may take a bit of time to prepare a reproduction for you.

Jackman3005 avatar Mar 21 '23 03:03 Jackman3005

This is something I'd like to fix, I just can't track down the offending code paths off the top of my head without a test case. Here's the sandbox template for creating issue test cases: https://codesandbox.io/s/6lx6ql1w5r

necolas avatar Mar 27 '23 19:03 necolas