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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[listbox] required prop does not work properly #948

Open
wojtekmaj opened this issue Jul 26, 2022 · 0 comments
Open

[listbox] required prop does not work properly #948

wojtekmaj opened this issue Jul 26, 2022 · 0 comments

Comments

@wojtekmaj
Copy link

馃悰 Bug report

Current Behavior

While required prop is correctly passed to ListboxInput, the presence of readOnly prop pretty much cancels it.

readOnly
required={required}

As per MDN article "HTML attribute: readonly":

Because a read-only field cannot have it's value changed by a user interaction, required does not have any effect on inputs with the readonly attribute also specified.

Expected behavior

When required prop is passed to Listbox/ListboxInput, without selecting value in said Listbox form submission should not happen; instead, native form error message should pop up and field should be focused.

Reproducible example

https://codesandbox.io/s/reach-listbox-validation-6dikr7

Suggested solution(s)

Your environment

Software Name(s) Version
Reach Package @react/listbox 0.17.0
React 16.12.0
Browser Chrome 102
Assistive tech n/a n/a
Node n/a n/a
npm/yarn n/a n/a
Operating System macOS 12.4
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

1 participant