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

[Bug]: CheckboxField component does not automatically generate "id" attribute when not given via props #25072

Closed
2 tasks done
adamsamec opened this issue Oct 4, 2022 · 0 comments · Fixed by #25079
Closed
2 tasks done

Comments

@adamsamec
Copy link
Contributor

adamsamec commented Oct 4, 2022

Library

React Components / v9 (@fluentui/react-components)

System Info

Reproducable with any browser.

Are you reporting Accessibility issue?

yes

Reproduction

(https://codesandbox.io/s/elegant-breeze-idk6eg?file=/example.tsx)[https://codesandbox.io/s/elegant-breeze-idk6eg?file=/example.tsx)

Bug Description

Whenever a labelled ChekcboxField component which has no "id" prop is created, no "id" attribute is generated automatically for the resultant rendered <input type="chekcbox"> element. This has severe implications for instance such that no accessible name is narrated for the checkbox when focused using a screen reader.

Repro steps

  1. In the code, create a labelled CheckboxField component like this: <CheckboxField label="Example" />
  2. Observe the resultant rendered <input type="checkbox"> element, e.g. via the browser developer tools.

Actual behavior

Observe that no "id" attribute is generated for the resultant checkbox element.

Expected behavior

An "id" attribute should be generated for the resultant checkbox element, that corresponds to the "for" attribute of the relevant <label> element.

Logs

No response

Requested priority

High

Products/sites affected

Fluent UI v9

Are you willing to submit a PR to fix?

no

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.
@adamsamec adamsamec changed the title [Bug]: ChekcboxField label gets mixed with InputField label when no "id" attribute is set [Bug]: ChekcboxField does not automatically generate "id" attributewhen not given via props Oct 4, 2022
@adamsamec adamsamec changed the title [Bug]: ChekcboxField does not automatically generate "id" attributewhen not given via props [Bug]: ChekcboxField component does not automatically generate "id" attribute when not given via props Oct 4, 2022
@behowell behowell self-assigned this Oct 4, 2022
@msft-fluent-ui-bot msft-fluent-ui-bot added the Status: Fixed Fixed in some PR label Oct 7, 2022
@khmakoto khmakoto changed the title [Bug]: ChekcboxField component does not automatically generate "id" attribute when not given via props [Bug]: CheckboxField component does not automatically generate "id" attribute when not given via props Oct 7, 2022
@microsoft microsoft locked as resolved and limited conversation to collaborators Nov 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.