Skip to content

Commit

Permalink
Add id to Checkbox component to proper a11y identification (#6771)
Browse files Browse the repository at this point in the history
Co-authored-by: Giulia Ghisini <[email protected]>
  • Loading branch information
Wagner3UB and giuliaghisini authored Mar 5, 2025
1 parent 583e3b2 commit ba43ff6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions news/6771.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a11y - Added id attribute to checkbox widget for proper identification and fixes label functionality for screen readers. @Wagner3UB
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ exports[`renders a Lead Image block Sidebar component 1`] = `
<input
checked={false}
className="hidden"
id="field-openLinkInNewTab"
name="field-openLinkInNewTab"
readOnly={true}
tabIndex={0}
Expand Down
1 change: 1 addition & 0 deletions src/components/manage/Widgets/CheckboxWidget.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const CheckboxWidget = (props) => {
<FormFieldWrapper {...props} columns={1}>
<div className="wrapper">
<Checkbox
id={`field-${id}`}
name={`field-${id}`}
checked={value || false}
disabled={isDisabled}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ exports[`CheckboxWidget renders a checkbox widget component 1`] = `
>
<input
class="hidden"
id="field-my-field"
name="field-my-field"
readonly=""
tabindex="0"
Expand Down Expand Up @@ -65,6 +66,7 @@ exports[`CheckboxWidget renders a checkbox widget component checked 1`] = `
<input
checked=""
class="hidden"
id="field-my-field"
name="field-my-field"
readonly=""
tabindex="0"
Expand Down

0 comments on commit ba43ff6

Please sign in to comment.