Skip to content

Commit

Permalink
Dropdown component honors ariaLabel prop (#7292)
Browse files Browse the repository at this point in the history
* don't define labelledBy aria attribute when we are providing an ariaLabel

* update snapshots to reflect no ariaLabelledBy attribute when ariaLabel is provided

* add change file
  • Loading branch information
ConorWuertz authored and micahgodbolt committed Dec 5, 2018
1 parent 7f58d3b commit d7f56b2
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
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

0 comments on commit d7f56b2

Please sign in to comment.