From 0dd4a1e8a49865ea94757cfaedd2a220fb70b001 Mon Sep 17 00:00:00 2001 From: Phoebe-0319 <60056296+Phoebe-0319@users.noreply.github.com> Date: Fri, 29 May 2020 10:03:26 -0700 Subject: [PATCH 01/13] Port #7517 & #7796 to add optional aria role property to allow override the default aria role in office-ui-fabric-react/5.79.1 (#13372) * Add role property into Document and this fix was ported from #7517 & #7796 * add change log Co-authored-by: Elizabeth Craig --- ...ffice-ui-fabric-react-5.79.1_2020-05-28-08-57.json | 11 +++++++++++ .../src/components/DocumentCard/DocumentCard.tsx | 2 +- .../src/components/DocumentCard/DocumentCard.types.ts | 7 +++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 common/changes/office-ui-fabric-react/hotfix_4-office-ui-fabric-react-5.79.1_2020-05-28-08-57.json diff --git a/common/changes/office-ui-fabric-react/hotfix_4-office-ui-fabric-react-5.79.1_2020-05-28-08-57.json b/common/changes/office-ui-fabric-react/hotfix_4-office-ui-fabric-react-5.79.1_2020-05-28-08-57.json new file mode 100644 index 0000000000000..e4b38862f1c79 --- /dev/null +++ b/common/changes/office-ui-fabric-react/hotfix_4-office-ui-fabric-react-5.79.1_2020-05-28-08-57.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "packageName": "office-ui-fabric-react", + "comment": "DocumentCard: add optional aria role property to allow override the default aria role.", + "type": "minor" + } + ], + "packageName": "office-ui-fabric-react", + "email": "xianwang@microsoft.com" +} \ No newline at end of file diff --git a/packages/office-ui-fabric-react/src/components/DocumentCard/DocumentCard.tsx b/packages/office-ui-fabric-react/src/components/DocumentCard/DocumentCard.tsx index 045fb0fd3a660..fb5eeee3f6904 100644 --- a/packages/office-ui-fabric-react/src/components/DocumentCard/DocumentCard.tsx +++ b/packages/office-ui-fabric-react/src/components/DocumentCard/DocumentCard.tsx @@ -34,7 +34,7 @@ export class DocumentCard extends BaseComponent { } // if this element is actionable it should have an aria role - const role = actionable ? (onClick ? 'button' : 'link') : undefined; + const role = this.props.role || (actionable ? (onClick ? 'button' : 'link') : undefined); const tabIndex = actionable ? 0 : undefined; return ( diff --git a/packages/office-ui-fabric-react/src/components/DocumentCard/DocumentCard.types.ts b/packages/office-ui-fabric-react/src/components/DocumentCard/DocumentCard.types.ts index e4bf525b74408..569ca62fb63e6 100644 --- a/packages/office-ui-fabric-react/src/components/DocumentCard/DocumentCard.types.ts +++ b/packages/office-ui-fabric-react/src/components/DocumentCard/DocumentCard.types.ts @@ -45,6 +45,13 @@ export interface IDocumentCardProps extends React.Props { */ className?: string; + /** + * Aria role assigned to the documentCard (Eg. button, link). + * Use this to override the default assignment. + * @defaultvalue When `onClick` is provided, default role will be 'button'. When `onClickHref` is provided, default role will be 'link'. + */ + role?: string; + /** * Hex color value of the line below the card, which should correspond to the document type. * This should only be supplied when using the 'compact' card layout. From f2991d544a034e266af2d91ff2e98da36fea1b2e Mon Sep 17 00:00:00 2001 From: Phoebe-0319 <60056296+Phoebe-0319@users.noreply.github.com> Date: Mon, 22 Jun 2020 12:41:26 -0700 Subject: [PATCH 02/13] Port #7172 to ensure nav links are announced once in office-ui-fabric-react/5.79.1 (#13658) --- ...ffice-ui-fabric-react-5.79.1_2020-06-18-03-07.json | 11 +++++++++++ .../src/components/Nav/Nav.base.tsx | 1 - 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 common/changes/office-ui-fabric-react/hotfix_6-office-ui-fabric-react-5.79.1_2020-06-18-03-07.json diff --git a/common/changes/office-ui-fabric-react/hotfix_6-office-ui-fabric-react-5.79.1_2020-06-18-03-07.json b/common/changes/office-ui-fabric-react/hotfix_6-office-ui-fabric-react-5.79.1_2020-06-18-03-07.json new file mode 100644 index 0000000000000..6954bdee7cbf9 --- /dev/null +++ b/common/changes/office-ui-fabric-react/hotfix_6-office-ui-fabric-react-5.79.1_2020-06-18-03-07.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "packageName": "office-ui-fabric-react", + "comment": "Ensures nav links are announced once", + "type": "patch" + } + ], + "packageName": "office-ui-fabric-react", + "email": "xianwang@microsoft.com" +} \ No newline at end of file diff --git a/packages/office-ui-fabric-react/src/components/Nav/Nav.base.tsx b/packages/office-ui-fabric-react/src/components/Nav/Nav.base.tsx index b0742dcd4add1..0873ba1dc42fa 100644 --- a/packages/office-ui-fabric-react/src/components/Nav/Nav.base.tsx +++ b/packages/office-ui-fabric-react/src/components/Nav/Nav.base.tsx @@ -163,7 +163,6 @@ export class NavBase extends BaseComponent implements INav styles={ buttonStyles } href={ link.url || (link.forceAnchor ? 'javascript:' : undefined) } iconProps={ link.iconProps || { iconName: link.icon || '' } } - ariaDescription={ link.title || link.name } onClick={ link.onClick ? this._onNavButtonLinkClicked.bind(this, link) : this._onNavAnchorLinkClicked.bind(this, link) } title={ link.title || link.name } target={ link.target } From dbafcd487a5e1e9c298bc9284d322eb7531e186c Mon Sep 17 00:00:00 2001 From: Phoebe-0319 <60056296+Phoebe-0319@users.noreply.github.com> Date: Mon, 22 Jun 2020 17:53:06 -0700 Subject: [PATCH 03/13] Port #10020 to remove role=presentation in FocusZone in office-ui-fabric-react/5.79.1 (#13659) --- ...ffice-ui-fabric-react-5.79.1_2020-06-18-06-33.json | 11 +++++++++++ .../Breadcrumb/__snapshots__/Breadcrumb.test.tsx.snap | 3 --- .../Calendar/__snapshots__/Calendar.test.tsx.snap | 2 -- .../__snapshots__/DetailsList.test.tsx.snap | 1 - .../src/components/FocusZone/FocusZone.tsx | 1 - .../components/Nav/__snapshots__/Nav.test.tsx.snap | 1 - .../Pivot/__snapshots__/Pivot.test.tsx.snap | 1 - .../Rating/__snapshots__/Rating.test.tsx.snap | 1 - .../__snapshots__/SwatchColorPicker.test.tsx.snap | 1 - .../pickers/__snapshots__/BasePicker.test.tsx.snap | 2 -- 10 files changed, 11 insertions(+), 13 deletions(-) create mode 100644 common/changes/office-ui-fabric-react/hotfix_7-office-ui-fabric-react-5.79.1_2020-06-18-06-33.json diff --git a/common/changes/office-ui-fabric-react/hotfix_7-office-ui-fabric-react-5.79.1_2020-06-18-06-33.json b/common/changes/office-ui-fabric-react/hotfix_7-office-ui-fabric-react-5.79.1_2020-06-18-06-33.json new file mode 100644 index 0000000000000..4d2200ebb08e2 --- /dev/null +++ b/common/changes/office-ui-fabric-react/hotfix_7-office-ui-fabric-react-5.79.1_2020-06-18-06-33.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "packageName": "office-ui-fabric-react", + "comment": "FocusZone: Remove role=presentation", + "type": "patch" + } + ], + "packageName": "office-ui-fabric-react", + "email": "xianwang@microsoft.com" +} \ No newline at end of file diff --git a/packages/office-ui-fabric-react/src/components/Breadcrumb/__snapshots__/Breadcrumb.test.tsx.snap b/packages/office-ui-fabric-react/src/components/Breadcrumb/__snapshots__/Breadcrumb.test.tsx.snap index 288b828f23dcf..a7985e0203de3 100644 --- a/packages/office-ui-fabric-react/src/components/Breadcrumb/__snapshots__/Breadcrumb.test.tsx.snap +++ b/packages/office-ui-fabric-react/src/components/Breadcrumb/__snapshots__/Breadcrumb.test.tsx.snap @@ -30,7 +30,6 @@ exports[`Breadcrumb renders breadcumb correctly 1`] = ` onFocus={[Function]} onKeyDown={[Function]} onMouseDownCapture={[Function]} - role="presentation" >
        implements IFo return (
        Date: Tue, 23 Jun 2020 11:19:39 -0700 Subject: [PATCH 04/13] Port #6244 to remove invalid aria-posinset and aria-setsize attributes in Commandbar (#13734) --- ...-fabric-react-5.79.1_2020-06-22-08-36.json | 11 +++++ .../components/CommandBar/CommandBar.test.tsx | 44 ------------------- .../src/components/CommandBar/CommandBar.tsx | 19 ++------ .../__snapshots__/CommandBar.test.tsx.snap | 2 - 4 files changed, 15 insertions(+), 61 deletions(-) create mode 100644 common/changes/office-ui-fabric-react/hotfix_8-office-ui-fabric-react-5.79.1_2020-06-22-08-36.json diff --git a/common/changes/office-ui-fabric-react/hotfix_8-office-ui-fabric-react-5.79.1_2020-06-22-08-36.json b/common/changes/office-ui-fabric-react/hotfix_8-office-ui-fabric-react-5.79.1_2020-06-22-08-36.json new file mode 100644 index 0000000000000..18cbaa7e57270 --- /dev/null +++ b/common/changes/office-ui-fabric-react/hotfix_8-office-ui-fabric-react-5.79.1_2020-06-22-08-36.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "packageName": "office-ui-fabric-react", + "comment": "Commandbar: remove invalid aria-posinset and aria-setsize attributes", + "type": "patch" + } + ], + "packageName": "office-ui-fabric-react", + "email": "xianwang@microsoft.com" +} \ No newline at end of file diff --git a/packages/office-ui-fabric-react/src/components/CommandBar/CommandBar.test.tsx b/packages/office-ui-fabric-react/src/components/CommandBar/CommandBar.test.tsx index 2783c1710eaed..7824d53954c51 100644 --- a/packages/office-ui-fabric-react/src/components/CommandBar/CommandBar.test.tsx +++ b/packages/office-ui-fabric-react/src/components/CommandBar/CommandBar.test.tsx @@ -43,50 +43,6 @@ describe('CommandBar', () => { expect(tree).toMatchSnapshot(); }); - it('adds the correct aria-setsize and -posinset attributes to the command bar items.', () => { - const items: IContextualMenuItem[] = [ - { - name: 'TestText 1', - key: 'TestKey1', - className: 'item1', - subMenuProps: { - items: [ - { - name: 'SubmenuText 1', - key: 'SubmenuKey1', - className: 'SubMenuClass' - } - ] - } - }, - { - name: 'TestText 2', - key: 'TestKey2', - className: 'item2', - }, - { - name: 'TestText 3', - key: 'TestKey3', - className: 'item3', - }, - ]; - - const renderedContent = ReactTestUtils.renderIntoDocument( - - ) as React.Component; - document.body.appendChild(ReactDOM.findDOMNode(renderedContent)); - - const [item1, item2, item3] = ['.item1', '.item2', '.item3'].map(i => document.querySelector(i)!.children[0]); - expect(item1.getAttribute('aria-setsize')).toBe('3'); - expect(item2.getAttribute('aria-setsize')).toBe('3'); - expect(item3.getAttribute('aria-setsize')).toBe('3'); - expect(item1.getAttribute('aria-posinset')).toBe('1'); - expect(item2.getAttribute('aria-posinset')).toBe('2'); - expect(item3.getAttribute('aria-posinset')).toBe('3'); - }); - it('opens a menu with deprecated IContextualMenuItem.items property', () => { const items: IContextualMenuItem[] = [ { diff --git a/packages/office-ui-fabric-react/src/components/CommandBar/CommandBar.tsx b/packages/office-ui-fabric-react/src/components/CommandBar/CommandBar.tsx index 000ff7d787639..59bd511f3a6b3 100644 --- a/packages/office-ui-fabric-react/src/components/CommandBar/CommandBar.tsx +++ b/packages/office-ui-fabric-react/src/components/CommandBar/CommandBar.tsx @@ -114,9 +114,6 @@ export class CommandBar extends BaseComponent ); } - // Total # of menu items is regular items + far items + 1 for the ellipsis, if necessary - const setSize = renderedItems!.length + renderedFarItems!.length + (renderedOverflowItems && renderedOverflowItems.length > 0 ? 1 : 0); - let posInSet = 1; return (
        @@ -124,7 +121,7 @@ export class CommandBar extends BaseComponent
        { renderedItems!.map(item => ( - this._renderItemInCommandBar(item, posInSet++, setSize, expandedMenuItemKey!) + this._renderItemInCommandBar(item, expandedMenuItemKey!) )).concat((renderedOverflowItems && renderedOverflowItems.length) ? [