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

Dropdown component honors ariaLabel prop #7292

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "office-ui-fabric-react",
"comment": "The Dropdown component will now only include an aria-labelled-by attribute when there is no provided ariaLabel prop. This means that the component will honor provided ariaLabels and create markup such that screen readers will read the aria label and not the regular label.",
"type": "minor"
}
],
"packageName": "office-ui-fabric-react",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export class DropdownBase extends BaseComponent<IDropdownInternalProps, IDropdow
aria-expanded={isOpen ? 'true' : 'false'}
role={ariaAttrs.role}
aria-label={ariaLabel}
aria-labelledby={label ? id + '-label' : undefined}
aria-labelledby={label && !ariaLabel ? id + '-label' : undefined}
aria-describedby={mergeAriaAttributeValues(optionId, keytipAttributes['aria-describedby'])}
aria-activedescendant={ariaAttrs.ariaActiveDescendant}
aria-disabled={disabled}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ exports[`Component Examples renders Dropdown.Basic.Example.tsx correctly 1`] = `
aria-describedby="Basicdrop1-option"
aria-expanded="false"
aria-label="Basic dropdown example"
aria-labelledby="Basicdrop1-label"
className=
ms-Dropdown
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ exports[`Component Examples renders Dropdown.Custom.Example.tsx correctly 1`] =
aria-describedby="Customdrop1-option"
aria-expanded="false"
aria-label="Custom dropdown example"
aria-labelledby="Customdrop1-label"
className=
ms-Dropdown
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ exports[`Component Examples renders Dropdown.Error.Example.tsx correctly 1`] = `
aria-describedby="Errormessagedrop1-option"
aria-expanded="false"
aria-label="Error message dropdown example"
aria-labelledby="Errormessagedrop1-label"
className=
ms-Dropdown
{
Expand Down