Skip to content

Commit

Permalink
Added consistent aria levels to any role='heading' (#5782)
Browse files Browse the repository at this point in the history
* Removed heading role from combo and contextualmenus, updated dialog and panel with aria-level 2

* Changefile
  • Loading branch information
micahgodbolt authored and dzearing committed Aug 9, 2018
1 parent 94ba1e9 commit d5129e5
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "office-ui-fabric-react",
"comment": "Removed unnecessary heading roles, and added aria-level to those requiring them",
"type": "patch"
}
],
"packageName": "office-ui-fabric-react",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@ export class ComboBox extends BaseComponent<IComboBoxProps, IComboBoxState> {
const { onRenderOption = this._onRenderOptionContent } = this.props;

return (
<div key={item.key} className={this._classNames.header} role="heading">
<div key={item.key} className={this._classNames.header}>
{onRenderOption(item, this._onRenderOptionContent)}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,7 @@ export class ContextualMenuBase extends BaseComponent<IContextualMenuProps, ICon
onKeyDown={this._onMenuKeyDown}
onKeyUp={this._onKeyUp}
>
{title && (
<div className={this._classNames.title} role="heading" aria-level={1}>
{' '}
{title}{' '}
</div>
)}
{title && <div className={this._classNames.title}> {title} </div>}
{items && items.length ? (
<FocusZone
{...this._adjustedFocusZoneProps}
Expand Down Expand Up @@ -574,7 +569,7 @@ export class ContextualMenuBase extends BaseComponent<IContextualMenuProps, ICon
const { contextualMenuItemAs: ChildrenRenderer = ContextualMenuItem } = this.props;

return (
<div className={this._classNames.header} style={item.style} role="heading" aria-level={this.props.title ? 2 : 1}>
<div className={this._classNames.header} style={item.style}>
<ChildrenRenderer
item={item}
classNames={classNames}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@ export class DialogContentBase extends BaseComponent<IDialogContentProps, {}> {
return (
<div className={classNames.content}>
<div className={classNames.header}>
<p className={classNames.title} id={titleId} role="heading">
<p className={classNames.title} id={titleId} role="heading" aria-level={2}>
{title}
</p>
<div className={classNames.topButton}>
{this.props.topButtonsProps!.map((props, index) => <IconButton key={props.uniqueId || index} {...props} />)}
{this.props.topButtonsProps!.map((props, index) => (
<IconButton key={props.uniqueId || index} {...props} />
))}
{(type === DialogType.close || (showCloseButton && type !== DialogType.largeHeader)) && (
<IconButton
className={classNames.button}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ exports[`Dialog renders Dialog correctly 1`] = `
}
>
<p
aria-level={2}
className=
ms-Dialog-title
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ export class Panel extends BaseComponent<IPanelProps, IPanelState> implements IP
className={css('ms-Panel-headerText', styles.headerText, headerClassName)}
id={headerTextId}
role="heading"
aria-level={2}
>
{headerText}
</p>
Expand Down

0 comments on commit d5129e5

Please sign in to comment.