From be4d0d0f8f804c35014dc967627c29cd576b8fdb Mon Sep 17 00:00:00 2001 From: Jason Gore Date: Mon, 11 Mar 2019 21:46:47 -0700 Subject: [PATCH 1/4] Fix FocusTrapZone with zero tabbable elements by marking the bumper divs as visible with data-is-visible. Regression was caused by position: fixed, which makes offsetParent null for isElementVisible check. --- .../components/FocusTrapZone/FocusTrapZone.tsx | 17 +++++++++++------ .../__snapshots__/HoverCard.test.tsx.snap | 4 ++++ .../Modal/__snapshots__/Modal.test.tsx.snap | 4 ++++ .../Panel/__snapshots__/Panel.test.tsx.snap | 2 ++ ...mmandBar.CommandBarButtonAs.Example.tsx.shot | 2 ++ .../Panel.HiddenOnDismiss.Example.tsx.shot | 2 ++ 6 files changed, 25 insertions(+), 6 deletions(-) diff --git a/packages/office-ui-fabric-react/src/components/FocusTrapZone/FocusTrapZone.tsx b/packages/office-ui-fabric-react/src/components/FocusTrapZone/FocusTrapZone.tsx index cac82d6562c8fc..21f1eb7129ccce 100644 --- a/packages/office-ui-fabric-react/src/components/FocusTrapZone/FocusTrapZone.tsx +++ b/packages/office-ui-fabric-react/src/components/FocusTrapZone/FocusTrapZone.tsx @@ -60,10 +60,15 @@ export class FocusTrapZone extends BaseComponent implem const { className, ariaLabelledBy } = this.props; const divProps = getNativeProps(this.props, divProperties); - const bumperStyle: React.CSSProperties = { - pointerEvents: 'none', - position: 'fixed' // 'fixed' prevents browsers from scrolling to bumpers when viewport does not contain them - }; + const bumperProps = { + style: { + pointerEvents: 'none', + position: 'fixed' // 'fixed' prevents browsers from scrolling to bumpers when viewport does not contain them + }, + tabIndex: 0, + 'aria-hidden': true, + 'data-is-visible': 'true' + } as React.HTMLAttributes; return (
implem onFocus={this._onRootFocus} onBlur={this._onRootBlur} > -
+
{this.props.children} -
+
); } diff --git a/packages/office-ui-fabric-react/src/components/HoverCard/__snapshots__/HoverCard.test.tsx.snap b/packages/office-ui-fabric-react/src/components/HoverCard/__snapshots__/HoverCard.test.tsx.snap index 3dc5ddd8f311c9..12f4544959252a 100644 --- a/packages/office-ui-fabric-react/src/components/HoverCard/__snapshots__/HoverCard.test.tsx.snap +++ b/packages/office-ui-fabric-react/src/components/HoverCard/__snapshots__/HoverCard.test.tsx.snap @@ -143,6 +143,7 @@ exports[`HoverCard renders ExpandingCard correctly 1`] = ` >
Date: Mon, 11 Mar 2019 21:48:21 -0700 Subject: [PATCH 2/4] Change file. --- .../jg-fix-ftz-no-tabbable_2019-03-12-04-48.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/office-ui-fabric-react/jg-fix-ftz-no-tabbable_2019-03-12-04-48.json diff --git a/common/changes/office-ui-fabric-react/jg-fix-ftz-no-tabbable_2019-03-12-04-48.json b/common/changes/office-ui-fabric-react/jg-fix-ftz-no-tabbable_2019-03-12-04-48.json new file mode 100644 index 00000000000000..f5501eb971b4bf --- /dev/null +++ b/common/changes/office-ui-fabric-react/jg-fix-ftz-no-tabbable_2019-03-12-04-48.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "packageName": "office-ui-fabric-react", + "comment": "FocusTrapZone: Fix for zones that have zero tabbable elements.", + "type": "patch" + } + ], + "packageName": "office-ui-fabric-react", + "email": "jagore@microsoft.com" +} \ No newline at end of file From 4fde56344626d6ce7144d1394d35339d6b91011a Mon Sep 17 00:00:00 2001 From: Jason Gore Date: Mon, 11 Mar 2019 21:51:53 -0700 Subject: [PATCH 3/4] Minor cleanup. --- .../src/components/FocusTrapZone/FocusTrapZone.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/office-ui-fabric-react/src/components/FocusTrapZone/FocusTrapZone.tsx b/packages/office-ui-fabric-react/src/components/FocusTrapZone/FocusTrapZone.tsx index 21f1eb7129ccce..90dfda30003e62 100644 --- a/packages/office-ui-fabric-react/src/components/FocusTrapZone/FocusTrapZone.tsx +++ b/packages/office-ui-fabric-react/src/components/FocusTrapZone/FocusTrapZone.tsx @@ -67,7 +67,7 @@ export class FocusTrapZone extends BaseComponent implem }, tabIndex: 0, 'aria-hidden': true, - 'data-is-visible': 'true' + 'data-is-visible': true } as React.HTMLAttributes; return ( From 58e9200a9eb897f812500b0c44936e7dae2b9f5e Mon Sep 17 00:00:00 2001 From: Jason Gore Date: Mon, 11 Mar 2019 22:01:17 -0700 Subject: [PATCH 4/4] Somewhat not so minor snapshot updates for minor fix. --- .../HoverCard/__snapshots__/HoverCard.test.tsx.snap | 8 ++++---- .../components/Modal/__snapshots__/Modal.test.tsx.snap | 8 ++++---- .../components/Panel/__snapshots__/Panel.test.tsx.snap | 4 ++-- .../CommandBar.CommandBarButtonAs.Example.tsx.shot | 4 ++-- .../__snapshots__/Panel.HiddenOnDismiss.Example.tsx.shot | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/office-ui-fabric-react/src/components/HoverCard/__snapshots__/HoverCard.test.tsx.snap b/packages/office-ui-fabric-react/src/components/HoverCard/__snapshots__/HoverCard.test.tsx.snap index 12f4544959252a..80d068b9800fef 100644 --- a/packages/office-ui-fabric-react/src/components/HoverCard/__snapshots__/HoverCard.test.tsx.snap +++ b/packages/office-ui-fabric-react/src/components/HoverCard/__snapshots__/HoverCard.test.tsx.snap @@ -143,7 +143,7 @@ exports[`HoverCard renders ExpandingCard correctly 1`] = ` >