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

focus() and Blur() programmatically stopped working for View

Open shashank-shanks opened this issue 8 years ago • 4 comments

The problem Views have stopped responding to focus() and blur() methods when done programatically after 0.8.0. It was working well in 0.7.3

How to reproduce

Simplified test case: https://codesandbox.io/s/xowm2yw084

Steps to reproduce:

  1. create a reference to a view
  2. call focus() on the ref programatically

Expected behavior The view needs to be focussed programmatically similar to how it does when going through components using the tab key.

Environment (include versions). Did this work in previous versions? It worked as expected in

  • React Native for Web (version): 0.7.3
  • React (version): "16.3.1"
  • Browser: Chrome 67.0.3396.87

shashank-shanks avatar Jun 26 '18 18:06 shashank-shanks

The test case is using 0.7.3

necolas avatar Jun 26 '18 19:06 necolas

I think the problem here is that you're using tabIndex which is no longer forwarded to the underlying DOM node. You can read more about the change in the release notes for 0.8.0

necolas avatar Jun 27 '18 02:06 necolas

That seems to be the case. Is there a work around to pass that prop to the underlying Node ? or any other alternative to using tabIndex ?

shashank-shanks avatar Jun 27 '18 19:06 shashank-shanks

https://github.com/necolas/react-native-web/blob/master/packages/website/guides/accessibility.md

necolas avatar Jun 28 '18 00:06 necolas