Skip to content

Commit

Permalink
Fix a11y violations reported in ContextualMenu examples (microsoft#6574)
Browse files Browse the repository at this point in the history
* Fix microsoft#6360 microsoft#12 - Unique IDs for CtxMenu demo page examples.

* Fix microsoft#6360 #2: Add label for hover delay TextField example

* Fix microsoft#6360 #1: Add aria-label to search input on filter CtxMenu example

* Add changefiles

* Update ContextualMenu snapshots
  • Loading branch information
KevinTCoughlin authored and micahgodbolt committed Oct 8, 2018
1 parent 296d90b commit a6d214e
Show file tree
Hide file tree
Showing 17 changed files with 61 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@uifabric/experiments",
"comment": "Fix a11y violations in Fluent ContextualMenu examples",
"type": "patch"
}
],
"packageName": "@uifabric/experiments",
"email": "keco@microsoft.com"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "office-ui-fabric-react",
"comment": "Fix a11y violations in ContextualMenu examples",
"type": "patch"
}
],
"packageName": "office-ui-fabric-react",
"email": "keco@microsoft.com"
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class FluentStylesContextualMenuExample extends React.Component<{}, {}> {
return (
<div>
<DefaultButton
id="ContextualMenuButton1"
id="FluentStylesContextualMenuExample"
text="Click for ContextualMenu"
menuProps={{
shouldFocusOnMount: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class ContextualMenuBasicExample extends React.Component {
return (
<div>
<DefaultButton
id="ContextualMenuButton1"
id="ContextualMenuBasicExample"
text="Click for ContextualMenu"
menuProps={{
shouldFocusOnMount: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class ContextualMenuWithCustomMenuItemExample extends React.Component {
return (
<div>
<DefaultButton
id="ContextualMenuButton1"
id="ContextualMenuWithCustomMenuItemExample"
text="Click for ContextualMenu"
menuProps={{
shouldFocusOnMount: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class ContextualMenuWithCustomMenuListExample extends React.Component<
return (
<div>
<DefaultButton
id="ContextualMenuButton1"
id="ContextualMenuWithCustomMenuListExample"
text="Click for ContextualMenu"
menuProps={{
onRenderMenuList: this._renderMenuList,
Expand Down Expand Up @@ -125,14 +125,12 @@ export class ContextualMenuWithCustomMenuListExample extends React.Component<
}));
}

private _renderMenuList(
menuListProps: IContextualMenuListProps,
defaultRender: IRenderFunction<IContextualMenuListProps>
) {
private _renderMenuList(menuListProps: IContextualMenuListProps, defaultRender: IRenderFunction<IContextualMenuListProps>) {
return (
<div>
<div style={{ borderBottom: '1px solid #ccc' }}>
<SearchBox
ariaLabel="Filter actions by text"
placeholder="Filter actions"
onAbort={this._onAbort}
onChange={this._onChange}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class ContextualMenuHeaderExample extends React.Component<{}, {}> {
public render(): JSX.Element {
return (
<DefaultButton
id="ContextualMenuButton1"
id="ContextualMenuHeaderExample"
text="Click for ContextualMenu"
menuProps={{
shouldFocusOnMount: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class ContextualMenuWithScrollBarExample extends React.Component<
return (
<div>
<DefaultButton
id="ContextualMenuButton1"
id="ContextualMenuWithScrollBarExample"
text="Click for ContextualMenu"
menuProps={{
shouldFocusOnMount: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class ContextualMenuSectionExample extends React.Component<any, any> {
return (
<div>
<DefaultButton
id="ContextualMenuButton1"
id="ContextualMenuSectionExample"
text="Click for ContextualMenu"
menuProps={{
items: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class ContextualMenuSubmenuExample extends React.Component<any, IContextu
public render(): JSX.Element {
return (
<div>
<TextField value={String(this.state.hoverDelay)} onChange={this._onHoverDelayChanged} />
<TextField value={String(this.state.hoverDelay)} label="Hover delay (ms)" onChange={this._onHoverDelayChanged} />
<DefaultButton
id="ContextualMenuButton2"
text="Click for ContextualMenu"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ exports[`Component Examples renders ContextualMenu.Basic.Example.tsx correctly 1
color: #212121;
}
data-is-focusable={true}
id="ContextualMenuButton1"
id="ContextualMenuBasicExample"
onClick={[Function]}
onKeyDown={[Function]}
onKeyPress={[Function]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ exports[`Component Examples renders ContextualMenu.CustomMenuItem.Example.tsx co
color: #212121;
}
data-is-focusable={true}
id="ContextualMenuButton1"
id="ContextualMenuWithCustomMenuItemExample"
onClick={[Function]}
onKeyDown={[Function]}
onKeyPress={[Function]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ exports[`Component Examples renders ContextualMenu.CustomMenuList.Example.tsx co
color: #212121;
}
data-is-focusable={true}
id="ContextualMenuButton1"
id="ContextualMenuWithCustomMenuListExample"
onClick={[Function]}
onKeyDown={[Function]}
onKeyPress={[Function]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ exports[`Component Examples renders ContextualMenu.Header.Example.tsx correctly
color: #212121;
}
data-is-focusable={true}
id="ContextualMenuButton1"
id="ContextualMenuHeaderExample"
onClick={[Function]}
onKeyDown={[Function]}
onKeyPress={[Function]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ exports[`Component Examples renders ContextualMenu.ScrollBar.Example.tsx correct
color: #212121;
}
data-is-focusable={true}
id="ContextualMenuButton1"
id="ContextualMenuWithScrollBarExample"
onClick={[Function]}
onKeyDown={[Function]}
onKeyPress={[Function]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ exports[`Component Examples renders ContextualMenu.Section.Example.tsx correctly
color: #212121;
}
data-is-focusable={true}
id="ContextualMenuButton1"
id="ContextualMenuSectionExample"
onClick={[Function]}
onKeyDown={[Function]}
onKeyPress={[Function]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,29 @@ exports[`Component Examples renders ContextualMenu.Submenu.Example.tsx correctly
ms-TextField-wrapper

>
<label
className=
ms-Label
{
box-shadow: none;
box-sizing: border-box;
color: #333333;
display: block;
margin-bottom: 0px;
margin-left: 0px;
margin-right: 0px;
margin-top: 0px;
overflow-wrap: break-word;
padding-bottom: 5px;
padding-left: 0;
padding-right: 0;
padding-top: 5px;
word-wrap: break-word;
}
htmlFor="TextField0"
>
Hover delay (ms)
</label>
<div
className=
ms-TextField-fieldGroup
Expand Down

0 comments on commit a6d214e

Please sign in to comment.