Skip to content

Commit

Permalink
feat(inputs): add aria-errormessage and aria-invalid on inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
CoroDaniel authored and cipak committed Mar 18, 2022
1 parent d536cc0 commit 380c5d1
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ Array [
className="wxc-input-field__form-control"
>
<input
aria-invalid="false"
aria-labelledby="wxc-0-label"
autoFocus={false}
className="wxc-input-field__input"
Expand Down Expand Up @@ -230,6 +231,7 @@ Array [
className="wxc-input-field__form-control"
>
<input
aria-invalid="false"
aria-labelledby="wxc-0-label"
autoFocus={false}
className="wxc-input-field__input"
Expand Down Expand Up @@ -285,6 +287,7 @@ Array [
className="wxc-input-field__form-control"
>
<input
aria-invalid="false"
aria-labelledby="wxc-0-label"
autoFocus={false}
className="wxc-input-field__input"
Expand Down Expand Up @@ -339,6 +342,7 @@ Array [
<div
aria-controls="wxc-0-options"
aria-haspopup="listbox"
aria-invalid="false"
aria-labelledby="wxc-0-label"
className="wxc-dropdown__selected-option "
id="wxc-0-control"
Expand Down Expand Up @@ -403,6 +407,7 @@ Array [
className="wxc-input-field__form-control"
>
<input
aria-invalid="false"
aria-labelledby="wxc-0-label"
autoFocus={false}
className="wxc-input-field__input"
Expand Down Expand Up @@ -580,6 +585,7 @@ Array [
className="wxc-input-field__form-control"
>
<input
aria-invalid="false"
aria-labelledby="wxc-0-label"
autoFocus={false}
className="wxc-input-field__input"
Expand Down Expand Up @@ -646,6 +652,7 @@ Array [
className="wxc-input-field__form-control"
>
<input
aria-invalid="false"
aria-labelledby="wxc-0-label"
autoFocus={false}
className="wxc-input-field__input"
Expand Down Expand Up @@ -697,6 +704,7 @@ Array [
className="wxc-input-field__form-control"
>
<input
aria-invalid="false"
aria-labelledby="wxc-0-label"
autoFocus={false}
className="wxc-input-field__input"
Expand Down Expand Up @@ -743,6 +751,7 @@ Array [
className="wxc-label__control"
>
<div
aria-invalid="false"
aria-labelledby="wxc-0-label"
role="radiogroup"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ Array [
<div
aria-controls="wxc-0-options"
aria-haspopup="listbox"
aria-invalid="false"
aria-label="Use arrow keys to navigate between camera options and hit \\"Enter\\" to select."
aria-labelledby="wxc-0-label"
className="wxc-dropdown__selected-option "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Array [
className="wxc-input-field__form-control"
>
<input
aria-invalid="false"
aria-label="Your name appears in the participant list. Skip this optional field to use the name provided by the system."
aria-labelledby="wxc-0-label"
autoFocus={true}
Expand Down Expand Up @@ -85,6 +86,8 @@ Array [
className="wxc-input-field__form-control"
>
<input
aria-errormessage=""
aria-invalid="false"
aria-label="The password is provided in the invitation for a scheduled meeting, or from the host."
aria-labelledby="wxc-0-label"
autoFocus={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ Array [
className="wxc-input-field__form-control"
>
<input
aria-errormessage=""
aria-invalid="false"
aria-label="The host key is generated when a meeting is scheduled."
aria-labelledby="wxc-0-label"
autoFocus={true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Array [
<div
aria-controls="wxc-0-options"
aria-haspopup="listbox"
aria-invalid="false"
aria-label="Use arrow keys to navigate between speaker options and hit \\"Enter\\" to select."
aria-labelledby="wxc-0-label"
className="wxc-dropdown__selected-option "
Expand Down Expand Up @@ -132,6 +133,7 @@ Array [
<div
aria-controls="wxc-0-options"
aria-haspopup="listbox"
aria-invalid="false"
aria-label="Use arrow keys to navigate between microphone options and hit \\"Enter\\" to select."
aria-labelledby="wxc-0-label"
className="wxc-dropdown__selected-option "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Array [
className="wxc-input-field__form-control"
>
<input
aria-invalid="false"
aria-labelledby="wxc-0-label"
autoFocus={false}
className="wxc-input-field__input"
Expand Down Expand Up @@ -120,6 +121,7 @@ Array [
className="wxc-input-field__form-control"
>
<input
aria-invalid="false"
aria-labelledby="wxc-0-label"
autoFocus={false}
className="wxc-input-field__input"
Expand Down Expand Up @@ -519,6 +521,7 @@ Array [
className="wxc-input-field__form-control"
>
<input
aria-invalid="false"
aria-labelledby="wxc-0-label"
autoFocus={false}
className="wxc-input-field__input"
Expand Down Expand Up @@ -557,6 +560,7 @@ Array [
className="wxc-input-field__form-control"
>
<input
aria-invalid="false"
aria-labelledby="wxc-0-label"
autoFocus={false}
className="wxc-input-field__input"
Expand Down Expand Up @@ -592,6 +596,7 @@ Array [
className="wxc-input-field__form-control"
>
<input
aria-invalid="false"
aria-labelledby="wxc-0-label"
autoFocus={false}
className="wxc-input-field__input"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Array [
<div
aria-controls="wxc-0-options"
aria-haspopup="listbox"
aria-invalid="false"
aria-labelledby="wxc-0-label"
className="wxc-dropdown__selected-option "
id="wxc-0-control"
Expand Down Expand Up @@ -106,6 +107,7 @@ Array [
<div
aria-controls="wxc-0-options"
aria-haspopup="listbox"
aria-invalid="false"
aria-labelledby="wxc-0-label"
className="wxc-dropdown__selected-option "
id="wxc-0-control"
Expand Down Expand Up @@ -162,6 +164,7 @@ Array [
className="wxc-label__control"
>
<div
aria-invalid="false"
aria-labelledby="wxc-0-label"
role="radiogroup"
>
Expand Down Expand Up @@ -240,6 +243,7 @@ Array [
className="wxc-label__control"
>
<div
aria-invalid="false"
aria-labelledby="wxc-0-label"
role="radiogroup"
>
Expand Down Expand Up @@ -309,6 +313,7 @@ Array [
className="wxc-label__control"
>
<div
aria-invalid="false"
aria-labelledby="wxc-0-label"
role="group"
>
Expand Down Expand Up @@ -383,6 +388,7 @@ Array [
className="wxc-label__control"
>
<div
aria-invalid="false"
aria-labelledby="wxc-0-label"
role="group"
>
Expand Down Expand Up @@ -575,6 +581,7 @@ Array [
className="wxc-input-field__form-control"
>
<input
aria-invalid="false"
aria-labelledby="wxc-0-label"
autoFocus={false}
className="wxc-input-field__input"
Expand Down Expand Up @@ -681,6 +688,7 @@ Array [
className="wxc-input-field__form-control"
>
<input
aria-invalid="false"
aria-labelledby="wxc-0-label"
autoFocus={false}
className="wxc-input-field__input"
Expand Down Expand Up @@ -905,6 +913,7 @@ Array [
className="wxc-input-field__form-control"
>
<input
aria-invalid="false"
aria-labelledby="wxc-0-label"
autoFocus={false}
className="wxc-input-field__input"
Expand Down Expand Up @@ -976,6 +985,7 @@ Array [
className="wxc-input-field__form-control"
>
<input
aria-invalid="false"
aria-labelledby="wxc-0-label"
autoFocus={false}
className="wxc-input-field__input"
Expand Down Expand Up @@ -1024,6 +1034,7 @@ Array [
className="wxc-input-field__form-control"
>
<input
aria-invalid="false"
aria-labelledby="wxc-0-label"
autoFocus={false}
className="wxc-input-field__input"
Expand Down Expand Up @@ -1072,6 +1083,7 @@ Array [
className="wxc-input-field__form-control"
>
<input
aria-invalid="false"
aria-labelledby="wxc-0-label"
autoFocus={false}
className="wxc-input-field__input"
Expand Down Expand Up @@ -1120,6 +1132,7 @@ Array [
className="wxc-input-field__form-control"
>
<input
aria-invalid="false"
aria-labelledby="wxc-0-label"
autoFocus={false}
className="wxc-input-field__input"
Expand Down Expand Up @@ -1343,6 +1356,7 @@ Array [
className="wxc-input-field__form-control"
>
<input
aria-invalid="false"
aria-labelledby="wxc-0-label"
autoFocus={false}
className="wxc-input-field__input"
Expand Down Expand Up @@ -1392,6 +1406,7 @@ Array [
className="wxc-input-field__form-control"
>
<input
aria-invalid="false"
aria-labelledby="wxc-0-label"
autoFocus={false}
className="wxc-input-field__input"
Expand Down Expand Up @@ -1436,6 +1451,7 @@ Array [
className="wxc-input-field__form-control"
>
<input
aria-invalid="false"
aria-labelledby="wxc-0-label"
autoFocus={false}
className="wxc-input-field__input"
Expand Down
2 changes: 2 additions & 0 deletions src/components/generic/InputField/InputField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ export default function InputField({
>
<div className={sc('form-control')}>
<input
aria-errormessage={error && `${id}-error`}
aria-invalid={error ? 'true' : 'false'}
aria-label={ariaLabel}
aria-labelledby={`${id}-label`}
// disabling no-autofocus because otherwise this element cannot be autofocused depending on the autoFocus prop
Expand Down
3 changes: 3 additions & 0 deletions src/components/inputs/CheckboxSet/CheckboxSet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ export default function CheckboxSet({
required={required}
style={style}
>
{/* eslint-disable-next-line jsx-a11y/role-supports-aria-props */}
<div
aria-describedby={error && `${id}-error`}
aria-invalid={error ? 'true' : 'false'}
aria-labelledby={`${id}-label`}
role="group"
>
Expand Down
2 changes: 2 additions & 0 deletions src/components/inputs/Dropdown/Dropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ export default function Dropdown({
{/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}
<div className={sc('control')} ref={controlRef} disabled={disabled} onKeyDown={handleKeyDown}>
<div
aria-errormessage={error && `${id}-error`}
aria-invalid={error ? 'true' : 'false'}
aria-controls={`${id}-options`}
aria-expanded={expanded}
aria-haspopup="listbox"
Expand Down
2 changes: 2 additions & 0 deletions src/components/inputs/RadioSet/RadioSet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export default function RadioSet({
style={style}
>
<div
aria-describedby={error && `${id}-error`}
aria-invalid={error ? 'true' : 'false'}
aria-labelledby={`${id}-label`}
role="radiogroup"
>
Expand Down

0 comments on commit 380c5d1

Please sign in to comment.