From bf0ffef2e2ba3114c60f24461c9f2abc84afe48c Mon Sep 17 00:00:00 2001 From: Natalie Ethell Date: Thu, 24 Jan 2019 17:26:06 -0800 Subject: [PATCH 01/13] render plain column header for selection column --- .../DetailsList/DetailsHeader.base.tsx | 35 +++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx b/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx index ae878f535568f..9e53b94fe9501 100644 --- a/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx +++ b/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx @@ -15,6 +15,10 @@ import { Layer } from '../../Layer'; import { GroupSpacer } from '../GroupedList/GroupSpacer'; import { CollapseAllVisibility } from '../../GroupedList'; import { DetailsRowCheck } from './DetailsRowCheck'; +import { ICheckStyleProps, ICheckStyles } from '../Check/Check.types'; +import { IDetailsRowCheckStyleProps, IDetailsRowCheckStyles } from './DetailsRowCheck.types'; +import { getStyles as getCheckStyles } from '../Check/Check.styles'; +import { getStyles as getDetailsRowCheckStyles } from './DetailsRowCheck.styles'; import { ITooltipHostProps } from '../../Tooltip'; import { ISelection, SelectionMode, SELECTION_CHANGE } from '../../utilities/selection/interfaces'; import { IDragDropOptions, DragDropHelper } from '../../utilities/dragdrop/index'; @@ -30,6 +34,9 @@ const MOUSEMOVE_PRIMARY_BUTTON = 1; // for mouse move event we are using ev.butt const NO_COLUMNS: IColumn[] = []; +const getCheckClassNames = classNamesFunction(); +const getRowCheckClassNames = classNamesFunction(); + export interface IDetailsHeader { focus: () => boolean; } @@ -210,6 +217,22 @@ export class DetailsHeaderBase extends BaseComponent + ) : ( +
) }, this._onRenderColumnHeaderTooltip From b388c4411fc71949585567bac3af104b99fc318b Mon Sep 17 00:00:00 2001 From: "REDMOND\\naethell" Date: Thu, 24 Jan 2019 17:47:20 -0800 Subject: [PATCH 02/13] remove unnecessary styles --- .../src/components/DetailsList/DetailsHeader.base.tsx | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx b/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx index 9e53b94fe9501..9ea9f567d22e8 100644 --- a/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx +++ b/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx @@ -218,12 +218,6 @@ export class DetailsHeaderBase extends BaseComponent {onRenderColumnHeaderTooltip( { @@ -280,7 +273,7 @@ export class DetailsHeaderBase extends BaseComponent ) From 82feea60f13946157991bd4c5f8ec51533a76194 Mon Sep 17 00:00:00 2001 From: Natalie Ethell Date: Thu, 24 Jan 2019 22:58:49 -0800 Subject: [PATCH 03/13] change file --- ...ilsListSelectionColumnHeader_2019-01-25-06-58.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/office-ui-fabric-react/detailsListSelectionColumnHeader_2019-01-25-06-58.json diff --git a/common/changes/office-ui-fabric-react/detailsListSelectionColumnHeader_2019-01-25-06-58.json b/common/changes/office-ui-fabric-react/detailsListSelectionColumnHeader_2019-01-25-06-58.json new file mode 100644 index 0000000000000..918d34457c2a0 --- /dev/null +++ b/common/changes/office-ui-fabric-react/detailsListSelectionColumnHeader_2019-01-25-06-58.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "packageName": "office-ui-fabric-react", + "comment": "DetailsList: render a simple column header for checkboxes in single selection mode", + "type": "patch" + } + ], + "packageName": "office-ui-fabric-react", + "email": "natalie.ethell@microsoft.com" +} \ No newline at end of file From c083aec5a6303dd7ee1dcc62ea8f4eb57148332d Mon Sep 17 00:00:00 2001 From: "REDMOND\\naethell" Date: Tue, 29 Jan 2019 11:12:25 -0800 Subject: [PATCH 04/13] remove more unnecessary styling --- .../src/components/DetailsList/DetailsHeader.base.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx b/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx index 9ea9f567d22e8..6bcb731d0a4f8 100644 --- a/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx +++ b/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx @@ -15,9 +15,7 @@ import { Layer } from '../../Layer'; import { GroupSpacer } from '../GroupedList/GroupSpacer'; import { CollapseAllVisibility } from '../../GroupedList'; import { DetailsRowCheck } from './DetailsRowCheck'; -import { ICheckStyleProps, ICheckStyles } from '../Check/Check.types'; import { IDetailsRowCheckStyleProps, IDetailsRowCheckStyles } from './DetailsRowCheck.types'; -import { getStyles as getCheckStyles } from '../Check/Check.styles'; import { getStyles as getDetailsRowCheckStyles } from './DetailsRowCheck.styles'; import { ITooltipHostProps } from '../../Tooltip'; import { ISelection, SelectionMode, SELECTION_CHANGE } from '../../utilities/selection/interfaces'; @@ -34,7 +32,6 @@ const MOUSEMOVE_PRIMARY_BUTTON = 1; // for mouse move event we are using ev.butt const NO_COLUMNS: IColumn[] = []; -const getCheckClassNames = classNamesFunction(); const getRowCheckClassNames = classNamesFunction(); export interface IDetailsHeader { From 8658371da26738a7cd48541d0d1eee831f953fb7 Mon Sep 17 00:00:00 2001 From: "REDMOND\\naethell" Date: Tue, 29 Jan 2019 11:43:47 -0800 Subject: [PATCH 05/13] do not render select all label if in single selection mode --- .../src/components/DetailsList/DetailsHeader.base.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx b/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx index 6bcb731d0a4f8..a5a46c0ead469 100644 --- a/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx +++ b/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx @@ -278,7 +278,7 @@ export class DetailsHeaderBase extends BaseComponent, - ariaLabelForSelectAllCheckbox && !this.props.onRenderColumnHeaderTooltip ? ( + !isCheckboxHidden && ariaLabelForSelectAllCheckbox && !this.props.onRenderColumnHeaderTooltip ? ( From 7bf83a400803260170cf2dff73d79a107ac8b0ee Mon Sep 17 00:00:00 2001 From: "REDMOND\\naethell" Date: Tue, 29 Jan 2019 15:40:47 -0800 Subject: [PATCH 06/13] add vr tests --- apps/vr-tests/src/stories/DetailsList.stories.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/apps/vr-tests/src/stories/DetailsList.stories.tsx b/apps/vr-tests/src/stories/DetailsList.stories.tsx index 5851066f8d261..0cbea1f5e945e 100644 --- a/apps/vr-tests/src/stories/DetailsList.stories.tsx +++ b/apps/vr-tests/src/stories/DetailsList.stories.tsx @@ -7,7 +7,8 @@ import { DetailsList, DetailsListLayoutMode, IColumn, - CheckboxVisibility + CheckboxVisibility, + SelectionMode } from 'office-ui-fabric-react'; const items = [ @@ -150,6 +151,16 @@ storiesOf('DetailsList', module) isHeaderVisible={true} /> )) + .addStory('Single Selection Mode', () => ( + + )) .addStory('Grouped', () => ( Date: Tue, 29 Jan 2019 16:02:28 -0800 Subject: [PATCH 07/13] add aria-describedby --- .../components/DetailsList/DetailsHeader.base.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx b/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx index a5a46c0ead469..5ff06dec4e9e5 100644 --- a/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx +++ b/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx @@ -272,15 +272,24 @@ export class DetailsHeaderBase extends BaseComponent ) }, this._onRenderColumnHeaderTooltip )}
, - !isCheckboxHidden && ariaLabelForSelectAllCheckbox && !this.props.onRenderColumnHeaderTooltip ? ( + !this.props.onRenderColumnHeaderTooltip ? ( + ariaLabelForSelectAllCheckbox && !isCheckboxHidden ? ( + + ) : null + ) : ariaLabelForSelectionColumn && isCheckboxHidden ? ( ) : null ] From 179f525c961e22a126c5cde124b7aadd939bf016 Mon Sep 17 00:00:00 2001 From: "REDMOND\\naethell" Date: Thu, 31 Jan 2019 14:16:42 -0800 Subject: [PATCH 08/13] render an empty check for single selection mode --- .../DetailsList/DetailsHeader.base.tsx | 41 +++++++------------ .../DetailsList/DetailsRowCheck.styles.ts | 3 +- .../DetailsList/DetailsRowCheck.tsx | 4 +- 3 files changed, 18 insertions(+), 30 deletions(-) diff --git a/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx b/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx index 5ff06dec4e9e5..9e74d5b52dabd 100644 --- a/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx +++ b/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx @@ -16,7 +16,6 @@ import { GroupSpacer } from '../GroupedList/GroupSpacer'; import { CollapseAllVisibility } from '../../GroupedList'; import { DetailsRowCheck } from './DetailsRowCheck'; import { IDetailsRowCheckStyleProps, IDetailsRowCheckStyles } from './DetailsRowCheck.types'; -import { getStyles as getDetailsRowCheckStyles } from './DetailsRowCheck.styles'; import { ITooltipHostProps } from '../../Tooltip'; import { ISelection, SelectionMode, SELECTION_CHANGE } from '../../utilities/selection/interfaces'; import { IDragDropOptions, DragDropHelper } from '../../utilities/dragdrop/index'; @@ -215,15 +214,6 @@ export class DetailsHeaderBase extends BaseComponent - ) : ( -
) }, this._onRenderColumnHeaderTooltip @@ -286,11 +273,11 @@ export class DetailsHeaderBase extends BaseComponent {ariaLabelForSelectAllCheckbox} + ) : ariaLabelForSelectionColumn && isCheckboxHidden ? ( + ) : null - ) : ariaLabelForSelectionColumn && isCheckboxHidden ? ( - ) : null ] : null} diff --git a/packages/office-ui-fabric-react/src/components/DetailsList/DetailsRowCheck.styles.ts b/packages/office-ui-fabric-react/src/components/DetailsList/DetailsRowCheck.styles.ts index 583b8adc7da25..e2c85149b69c1 100644 --- a/packages/office-ui-fabric-react/src/components/DetailsList/DetailsRowCheck.styles.ts +++ b/packages/office-ui-fabric-react/src/components/DetailsList/DetailsRowCheck.styles.ts @@ -10,7 +10,7 @@ const GlobalClassNames = { }; export const getStyles = (props: IDetailsRowCheckStyleProps): IDetailsRowCheckStyles => { - const { theme, className, isHeader, selected, anySelected, canSelect, compact, isVisible } = props; + const { theme, className, isHeader, selected, anySelected, compact, isVisible } = props; const classNames = getGlobalClassNames(GlobalClassNames, theme); const { rowHeight, compactRowHeight } = DEFAULT_ROW_HEIGHTS; @@ -22,7 +22,6 @@ export const getStyles = (props: IDetailsRowCheckStyleProps): IDetailsRowCheckSt root: [classNames.root, className], check: [ - !canSelect && [classNames.isDisabled, { visibility: 'hidden' }], isHeader && classNames.isHeader, getFocusStyle(theme), theme.fonts.small, diff --git a/packages/office-ui-fabric-react/src/components/DetailsList/DetailsRowCheck.tsx b/packages/office-ui-fabric-react/src/components/DetailsList/DetailsRowCheck.tsx index 22dc1832b4826..89febd5b59042 100644 --- a/packages/office-ui-fabric-react/src/components/DetailsList/DetailsRowCheck.tsx +++ b/packages/office-ui-fabric-react/src/components/DetailsList/DetailsRowCheck.tsx @@ -46,7 +46,7 @@ const DetailsRowCheckBase = (props: IDetailsRowCheckProps) => { compact }); - return ( + return canSelect ? (
{ >
+ ) : ( +
); }; From 59087b4456654e14d2f9a7784c8aa667125e5956 Mon Sep 17 00:00:00 2001 From: "REDMOND\\naethell" Date: Thu, 31 Jan 2019 14:27:26 -0800 Subject: [PATCH 09/13] cleanup old styling --- .../src/components/DetailsList/DetailsHeader.base.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx b/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx index 9e74d5b52dabd..34f8903601aec 100644 --- a/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx +++ b/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx @@ -15,7 +15,6 @@ import { Layer } from '../../Layer'; import { GroupSpacer } from '../GroupedList/GroupSpacer'; import { CollapseAllVisibility } from '../../GroupedList'; import { DetailsRowCheck } from './DetailsRowCheck'; -import { IDetailsRowCheckStyleProps, IDetailsRowCheckStyles } from './DetailsRowCheck.types'; import { ITooltipHostProps } from '../../Tooltip'; import { ISelection, SelectionMode, SELECTION_CHANGE } from '../../utilities/selection/interfaces'; import { IDragDropOptions, DragDropHelper } from '../../utilities/dragdrop/index'; @@ -31,8 +30,6 @@ const MOUSEMOVE_PRIMARY_BUTTON = 1; // for mouse move event we are using ev.butt const NO_COLUMNS: IColumn[] = []; -const getRowCheckClassNames = classNamesFunction(); - export interface IDetailsHeader { focus: () => boolean; } From b123b33587e956dcd8760833c934fb93a1e571e9 Mon Sep 17 00:00:00 2001 From: "REDMOND\\naethell" Date: Thu, 31 Jan 2019 14:31:55 -0800 Subject: [PATCH 10/13] keep is-disabled classname --- .../src/components/DetailsList/DetailsRowCheck.styles.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/office-ui-fabric-react/src/components/DetailsList/DetailsRowCheck.styles.ts b/packages/office-ui-fabric-react/src/components/DetailsList/DetailsRowCheck.styles.ts index e2c85149b69c1..13a281411c307 100644 --- a/packages/office-ui-fabric-react/src/components/DetailsList/DetailsRowCheck.styles.ts +++ b/packages/office-ui-fabric-react/src/components/DetailsList/DetailsRowCheck.styles.ts @@ -10,7 +10,7 @@ const GlobalClassNames = { }; export const getStyles = (props: IDetailsRowCheckStyleProps): IDetailsRowCheckStyles => { - const { theme, className, isHeader, selected, anySelected, compact, isVisible } = props; + const { theme, className, isHeader, selected, anySelected, canSelect, compact, isVisible } = props; const classNames = getGlobalClassNames(GlobalClassNames, theme); const { rowHeight, compactRowHeight } = DEFAULT_ROW_HEIGHTS; @@ -22,6 +22,7 @@ export const getStyles = (props: IDetailsRowCheckStyleProps): IDetailsRowCheckSt root: [classNames.root, className], check: [ + !canSelect && classNames.isDisabled, isHeader && classNames.isHeader, getFocusStyle(theme), theme.fonts.small, From 95808a20fae79485f02816dbb3d842cc64798548 Mon Sep 17 00:00:00 2001 From: Kevin Coughlin Date: Fri, 1 Feb 2019 16:15:58 -0800 Subject: [PATCH 11/13] Update packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx Co-Authored-By: natalieethell --- .../src/components/DetailsList/DetailsHeader.base.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx b/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx index 34f8903601aec..e8e3baebf0166 100644 --- a/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx +++ b/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx @@ -257,7 +257,7 @@ export class DetailsHeaderBase extends BaseComponent ) From 578bb0dd03f5adba6dd2f8fb5c922c4ca46e9d95 Mon Sep 17 00:00:00 2001 From: Kevin Coughlin Date: Fri, 1 Feb 2019 16:17:12 -0800 Subject: [PATCH 12/13] Update packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx Co-Authored-By: natalieethell --- .../src/components/DetailsList/DetailsHeader.base.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx b/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx index e8e3baebf0166..637c6282e2b0a 100644 --- a/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx +++ b/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.base.tsx @@ -253,7 +253,7 @@ export class DetailsHeaderBase extends BaseComponent Date: Fri, 1 Feb 2019 16:40:26 -0800 Subject: [PATCH 13/13] add snapshot test --- .../DetailsList/DetailsHeader.test.tsx | 15 +- .../__snapshots__/DetailsHeader.test.tsx.snap | 802 +++++++++++++++++- 2 files changed, 800 insertions(+), 17 deletions(-) diff --git a/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.test.tsx b/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.test.tsx index db0a581d34fd0..347cb447c0943 100644 --- a/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.test.tsx +++ b/packages/office-ui-fabric-react/src/components/DetailsList/DetailsHeader.test.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import { DetailsHeader } from './DetailsHeader'; -import { IDetailsHeader, IDropHintDetails } from './DetailsHeader.types'; +import { IDetailsHeader, IDropHintDetails, SelectAllVisibility } from './DetailsHeader.types'; import { DetailsListLayoutMode, IColumn, ColumnActionsMode } from './DetailsList.types'; import { Selection, SelectionMode } from '../../utilities/selection/index'; import { EventGroup } from '../../Utilities'; @@ -247,6 +247,19 @@ describe('DetailsHeader', () => { expect(component.toJSON()).toMatchSnapshot(); }); + it('can render a hidden select all checkbox in single selection mode', () => { + const component = renderer.create( + + ); + expect(component.toJSON()).toMatchSnapshot(); + }); + it('can resize columns', () => { let lastResize = { size: -1, index: -1 }; diff --git a/packages/office-ui-fabric-react/src/components/DetailsList/__snapshots__/DetailsHeader.test.tsx.snap b/packages/office-ui-fabric-react/src/components/DetailsList/__snapshots__/DetailsHeader.test.tsx.snap index 1347b5f5aceb0..e362e35b5d97e 100644 --- a/packages/office-ui-fabric-react/src/components/DetailsList/__snapshots__/DetailsHeader.test.tsx.snap +++ b/packages/office-ui-fabric-react/src/components/DetailsList/__snapshots__/DetailsHeader.test.tsx.snap @@ -868,6 +868,776 @@ exports[`DetailsHeader can render 1`] = `
`; +exports[`DetailsHeader can render a hidden select all checkbox in single selection mode 1`] = ` +
+
+ +
+ +
+
+ + + + a + + + +
+
+
+ + + + b + + +  + + + +
+
+
+ + + + c + + +  + + + +
+
+
+`; + exports[`DetailsHeader renders accessible labels 1`] = `