Skip to content

Commit

Permalink
Updated ComboBox error to have role="alert" (#20013)
Browse files Browse the repository at this point in the history
* Updated error to be role alert

* Change files

* Updated snapshot in react-experiments

* Change files
  • Loading branch information
GeoffCoxMSFT authored Sep 29, 2021
1 parent 94916b2 commit e726d8b
Show file tree
Hide file tree
Showing 15 changed files with 20 additions and 186 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Updated error to be role alert",
"packageName": "@fluentui/react",
"email": "gcox@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Updated experiment snapshot that uses ComboBox",
"packageName": "@fluentui/react-experiments",
"email": "gcox@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -398,15 +398,6 @@ exports[`Component Examples renders ComboBox.Basic.Example.tsx correctly 1`] = `
</span>
</button>
</div>
<div
aria-atomic="true"
aria-hidden={true}
aria-live="polite"
id="ComboBox0-error"
role="region"
>

</div>
</div>
<button
className=
Expand Down Expand Up @@ -963,15 +954,6 @@ exports[`Component Examples renders ComboBox.Basic.Example.tsx correctly 1`] = `
</span>
</button>
</div>
<div
aria-atomic="true"
aria-hidden={true}
aria-live="polite"
id="ComboBox7-error"
role="region"
>

</div>
</div>
</div>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -418,15 +418,6 @@ exports[`Component Examples renders ComboBox.Controlled.Example.tsx correctly 1`
</span>
</button>
</div>
<div
aria-atomic="true"
aria-hidden={true}
aria-live="polite"
id="ComboBox0-error"
role="region"
>

</div>
</div>
<div
className=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,15 +440,6 @@ exports[`Component Examples renders ComboBox.ControlledMulti.Example.tsx correct
</span>
</button>
</div>
<div
aria-atomic="true"
aria-hidden={true}
aria-live="polite"
id="ComboBox0-error"
role="region"
>

</div>
</div>
<div
className=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,15 +418,6 @@ exports[`Component Examples renders ComboBox.CustomStyled.Example.tsx correctly
</span>
</button>
</div>
<div
aria-atomic="true"
aria-hidden={true}
aria-live="polite"
id="ComboBox0-error"
role="region"
>

</div>
</div>
<div
className="ms-ComboBox-container "
Expand Down Expand Up @@ -824,15 +815,6 @@ exports[`Component Examples renders ComboBox.CustomStyled.Example.tsx correctly
</span>
</button>
</div>
<div
aria-atomic="true"
aria-hidden={true}
aria-live="polite"
id="ComboBox4-error"
role="region"
>

</div>
</div>
</div>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,6 @@ exports[`Component Examples renders ComboBox.ErrorHandling.Example.tsx correctly
</button>
</div>
<div
aria-atomic="true"
aria-live="polite"
className=

{
Expand All @@ -369,7 +367,7 @@ exports[`Component Examples renders ComboBox.ErrorHandling.Example.tsx correctly
margin-top: 5px;
}
id="ComboBox0-error"
role="region"
role="alert"
>
Oh no! This ComboBox has an error!
</div>
Expand Down Expand Up @@ -770,15 +768,6 @@ exports[`Component Examples renders ComboBox.ErrorHandling.Example.tsx correctly
</span>
</button>
</div>
<div
aria-atomic="true"
aria-hidden={true}
aria-live="polite"
id="ComboBox4-error"
role="region"
>

</div>
</div>
</div>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -398,15 +398,6 @@ exports[`Component Examples renders ComboBox.Inline.Example.tsx correctly 1`] =
</span>
</button>
</div>
<div
aria-atomic="true"
aria-hidden={true}
aria-live="polite"
id="ComboBox0-error"
role="region"
>

</div>
</div>
<div
style={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,15 +420,6 @@ exports[`Component Examples renders ComboBox.SelectAll.Example.tsx correctly 1`]
</span>
</button>
</div>
<div
aria-atomic="true"
aria-hidden={true}
aria-live="polite"
id="ComboBox0-error"
role="region"
>

</div>
</div>
<div
className="ms-ComboBox-container "
Expand Down Expand Up @@ -848,15 +839,6 @@ exports[`Component Examples renders ComboBox.SelectAll.Example.tsx correctly 1`]
</span>
</button>
</div>
<div
aria-atomic="true"
aria-hidden={true}
aria-live="polite"
id="ComboBox4-error"
role="region"
>

</div>
</div>
</div>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -418,15 +418,6 @@ exports[`Component Examples renders ComboBox.Toggles.Example.tsx correctly 1`] =
</span>
</button>
</div>
<div
aria-atomic="true"
aria-hidden={true}
aria-live="polite"
id="ComboBox0-error"
role="region"
>

</div>
</div>
<div
className=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,14 +397,5 @@ exports[`Component Examples renders ComboBox.Virtualized.Example.tsx correctly 1
</span>
</button>
</div>
<div
aria-atomic="true"
aria-hidden={true}
aria-live="polite"
id="ComboBox0-error"
role="region"
>

</div>
</div>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -421,15 +421,6 @@ exports[`Component Examples renders TimePicker.Example.tsx correctly 1`] = `
</span>
</button>
</div>
<div
aria-atomic="true"
aria-hidden={true}
aria-live="polite"
id="ComboBox0-error"
role="region"
>

</div>
</div>
<div
className="ms-ComboBox-container "
Expand Down Expand Up @@ -829,15 +820,6 @@ exports[`Component Examples renders TimePicker.Example.tsx correctly 1`] = `
</span>
</button>
</div>
<div
aria-atomic="true"
aria-hidden={true}
aria-live="polite"
id="ComboBox4-error"
role="region"
>

</div>
</div>
<div
className="ms-ComboBox-container "
Expand Down Expand Up @@ -1237,15 +1219,6 @@ exports[`Component Examples renders TimePicker.Example.tsx correctly 1`] = `
</span>
</button>
</div>
<div
aria-atomic="true"
aria-hidden={true}
aria-live="polite"
id="ComboBox8-error"
role="region"
>

</div>
</div>
</div>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -1718,15 +1718,6 @@ exports[`Pagination render comboBox Pagination correctly 1`] = `
</span>
</button>
</div>
<div
aria-atomic="true"
aria-hidden={true}
aria-live="polite"
id="ComboBox6-error"
role="region"
>
</div>
</div>
<button
aria-label="next page"
Expand Down
14 changes: 5 additions & 9 deletions packages/react/src/components/ComboBox/ComboBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -464,15 +464,11 @@ class ComboBoxInternal extends React.Component<IComboBoxInternalProps, IComboBox
},
this._onRenderContainer,
)}
<div
role="region"
aria-live="polite"
aria-atomic="true"
id={errorMessageId}
{...(hasErrorMessage ? { className: this._classNames.errorMessage } : { 'aria-hidden': true })}
>
{errorMessage !== undefined ? errorMessage : ''}
</div>
{hasErrorMessage && (
<div role="alert" id={errorMessageId} className={this._classNames.errorMessage}>
{errorMessage}
</div>
)}
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,15 +367,6 @@ exports[`ComboBox Renders correctly 1`] = `
</span>
</button>
</div>
<div
aria-atomic="true"
aria-hidden={true}
aria-live="polite"
id="ComboBox0-error"
role="region"
>
</div>
</div>
`;
Expand Down Expand Up @@ -1136,13 +1127,6 @@ exports[`ComboBox Renders correctly when open 1`] = `
</div>
</div>
</span>
<div
aria-atomic="true"
aria-hidden="true"
aria-live="polite"
id="ComboBox0-error"
role="region"
/>
</div>
`;
Expand Down Expand Up @@ -2012,13 +1996,6 @@ exports[`ComboBox Renders correctly when opened in multi-select mode 1`] = `
</div>
</div>
</span>
<div
aria-atomic="true"
aria-hidden="true"
aria-live="polite"
id="ComboBox0-error"
role="region"
/>
</div>
`;
Expand Down Expand Up @@ -2364,12 +2341,5 @@ exports[`ComboBox renders with a Keytip correctly 1`] = `
</span>
</button>
</div>
<div
aria-atomic="true"
aria-hidden="true"
aria-live="polite"
id="ComboBox0-error"
role="region"
/>
</div>
`;

0 comments on commit e726d8b

Please sign in to comment.