Skip to content
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

accessibilityRole="form" does not preserve onSubmit handler #1034

Closed
paularmstrong opened this issue Jul 11, 2018 · 2 comments
Closed

accessibilityRole="form" does not preserve onSubmit handler #1034

paularmstrong opened this issue Jul 11, 2018 · 2 comments

Comments

@paularmstrong
Copy link
Contributor

paularmstrong commented Jul 11, 2018

The problem
Using accessibilityRole="form" with onSubmit={someHandler}, someHandler is not called when hitting the return key in a nested TextInput.

How to reproduce
Simplified test case: https://codesandbox.io/s/6y37n189kn

Steps to reproduce:

  1. Go to the codesanbox link
  2. Type in the input field
  3. Hit your enter/return key to submit the form

Expected behavior
Expectation is that the onSubmit handler is called and the event is prevented.

Actual behavior
The page is submitted and reloaded.

Environment (include versions). Did this work in previous versions?

@necolas
Copy link
Owner

necolas commented Jul 11, 2018

As we discussed elsewhere, the callback is not supported following the tightening of the API to align with RN in 0.8. You can achieve the desired result by using the onSubmitEditing prop on TextInput

@necolas necolas closed this as completed Jul 11, 2018
@necolas
Copy link
Owner

necolas commented Jul 11, 2018

Maybe the library should call preventDefault internally to avoid the unexpected behaviour within a form, or use aria instead of a form element

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants