-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
overlay.tsx
679 lines (602 loc) · 25.8 KB
/
overlay.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
/*
* Copyright 2015 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import classNames from "classnames";
import * as React from "react";
import { findDOMNode } from "react-dom";
import { CSSTransition, TransitionGroup } from "react-transition-group";
import { AbstractPureComponent2, Classes, Keys } from "../../common";
import { DISPLAYNAME_PREFIX, HTMLDivProps, Props } from "../../common/props";
import { getActiveElement, isFunction } from "../../common/utils";
import { Portal } from "../portal/portal";
// eslint-disable-next-line deprecation/deprecation
export type OverlayableProps = IOverlayableProps;
/** @deprecated use OverlayableProps */
export interface IOverlayableProps extends IOverlayLifecycleProps {
/**
* Whether the overlay should acquire application focus when it first opens.
*
* @default true
*/
autoFocus?: boolean;
/**
* Whether pressing the `esc` key should invoke `onClose`.
*
* @default true
*/
canEscapeKeyClose?: boolean;
/**
* Whether the overlay should prevent focus from leaving itself. That is, if the user attempts
* to focus an element outside the overlay and this prop is enabled, then the overlay will
* immediately bring focus back to itself. If you are nesting overlay components, either disable
* this prop on the "outermost" overlays or mark the nested ones `usePortal={false}`.
*
* @default true
*/
enforceFocus?: boolean;
/**
* If `true` and `usePortal={true}`, the `Portal` containing the children is created and attached
* to the DOM when the overlay is opened for the first time; otherwise this happens when the
* component mounts. Lazy mounting provides noticeable performance improvements if you have lots
* of overlays at once, such as on each row of a table.
*
* @default true
*/
lazy?: boolean;
/**
* Whether the application should return focus to the last active element in the
* document after this overlay closes.
*
* @default true
*/
shouldReturnFocusOnClose?: boolean;
/**
* Indicates how long (in milliseconds) the overlay's enter/leave transition takes.
* This is used by React `CSSTransition` to know when a transition completes and must match
* the duration of the animation in CSS. Only set this prop if you override Blueprint's default
* transitions with new transitions of a different length.
*
* @default 300
*/
transitionDuration?: number;
/**
* Whether the overlay should be wrapped in a `Portal`, which renders its contents in a new
* element attached to `portalContainer` prop.
*
* This prop essentially determines which element is covered by the backdrop: if `false`,
* then only its parent is covered; otherwise, the entire page is covered (because the parent
* of the `Portal` is the `<body>` itself).
*
* Set this prop to `false` on nested overlays (such as `Dialog` or `Popover`) to ensure that they
* are rendered above their parents.
*
* @default true
*/
usePortal?: boolean;
/**
* Space-delimited string of class names applied to the `Portal` element if
* `usePortal={true}`.
*/
portalClassName?: string;
/**
* The container element into which the overlay renders its contents, when `usePortal` is `true`.
* This prop is ignored if `usePortal` is `false`.
*
* @default document.body
*/
portalContainer?: HTMLElement;
/**
* A callback that is invoked when user interaction causes the overlay to close, such as
* clicking on the overlay or pressing the `esc` key (if enabled).
*
* Receives the event from the user's interaction, if there was an event (generally either a
* mouse or key event). Note that, since this component is controlled by the `isOpen` prop, it
* will not actually close itself until that prop becomes `false`.
*/
onClose?: (event: React.SyntheticEvent<HTMLElement>) => void;
}
export type OverlayLifecycleProps = IOverlayLifecycleProps;
export interface IOverlayLifecycleProps {
/**
* Lifecycle method invoked just before the CSS _close_ transition begins on
* a child. Receives the DOM element of the child being closed.
*/
onClosing?: (node: HTMLElement) => void;
/**
* Lifecycle method invoked just after the CSS _close_ transition ends but
* before the child has been removed from the DOM. Receives the DOM element
* of the child being closed.
*/
onClosed?: (node: HTMLElement) => void;
/**
* Lifecycle method invoked just after mounting the child in the DOM but
* just before the CSS _open_ transition begins. Receives the DOM element of
* the child being opened.
*/
onOpening?: (node: HTMLElement) => void;
/**
* Lifecycle method invoked just after the CSS _open_ transition ends.
* Receives the DOM element of the child being opened.
*/
onOpened?: (node: HTMLElement) => void;
}
export type BackdropProps = IBackdropProps;
export interface IBackdropProps {
/** CSS class names to apply to backdrop element. */
backdropClassName?: string;
/** HTML props for the backdrop element. */
backdropProps?: React.HTMLProps<HTMLDivElement>;
/**
* Whether clicking outside the overlay element (either on backdrop when present or on document)
* should invoke `onClose`.
*
* @default true
*/
canOutsideClickClose?: boolean;
/**
* Whether a container-spanning backdrop element should be rendered behind the contents.
*
* @default true
*/
hasBackdrop?: boolean;
}
// eslint-disable-next-line deprecation/deprecation
export type OverlayProps = IOverlayProps;
/** @deprecated use OverlayProps */
export interface IOverlayProps extends OverlayableProps, IBackdropProps, Props {
/** Element to overlay. */
children?: React.ReactNode;
/**
* Toggles the visibility of the overlay and its children.
* This prop is required because the component is controlled.
*/
isOpen: boolean;
/**
* Name of the transition for internal `CSSTransition`.
* Providing your own name here will require defining new CSS transition properties.
*
* @default Classes.OVERLAY
*/
transitionName?: string;
}
export interface IOverlayState {
hasEverOpened?: boolean;
}
/**
* Overlay component.
*
* @see https://blueprintjs.com/docs/#core/components/overlay
*/
export class Overlay extends AbstractPureComponent2<OverlayProps, IOverlayState> {
public static displayName = `${DISPLAYNAME_PREFIX}.Overlay`;
public static defaultProps: OverlayProps = {
autoFocus: true,
backdropProps: {},
canEscapeKeyClose: true,
canOutsideClickClose: true,
enforceFocus: true,
hasBackdrop: true,
isOpen: false,
lazy: true,
shouldReturnFocusOnClose: true,
transitionDuration: 300,
transitionName: Classes.OVERLAY,
usePortal: true,
};
public static getDerivedStateFromProps({ isOpen: hasEverOpened }: OverlayProps) {
if (hasEverOpened) {
return { hasEverOpened };
}
return null;
}
private static openStack: Overlay[] = [];
private static getLastOpened = () => Overlay.openStack[Overlay.openStack.length - 1];
private isAutoFocusing = false;
private lastActiveElementBeforeOpened: Element | null | undefined;
public state: IOverlayState = {
hasEverOpened: this.props.isOpen,
};
// an HTMLElement that contains the backdrop and any children, to query for focus target
public containerElement: HTMLElement | null = null;
// An empty, keyboard-focusable div at the beginning of the Overlay content
private startFocusTrapElement: HTMLDivElement | null = null;
// An empty, keyboard-focusable div at the end of the Overlay content
private endFocusTrapElement: HTMLDivElement | null = null;
private refHandlers = {
// HACKHACK: see https://github.com/palantir/blueprint/issues/3979
/* eslint-disable-next-line react/no-find-dom-node */
container: (ref: TransitionGroup | null) => (this.containerElement = findDOMNode(ref) as HTMLElement),
endFocusTrap: (ref: HTMLDivElement | null) => (this.endFocusTrapElement = ref),
startFocusTrap: (ref: HTMLDivElement | null) => (this.startFocusTrapElement = ref),
};
public render() {
// oh snap! no reason to render anything at all if we're being truly lazy
if (this.props.lazy && !this.state.hasEverOpened) {
return null;
}
const { autoFocus, children, className, enforceFocus, usePortal, isOpen } = this.props;
// TransitionGroup types require single array of children; does not support nested arrays.
// So we must collapse backdrop and children into one array, and every item must be wrapped in a
// Transition element (no ReactText allowed).
const childrenWithTransitions = isOpen ? React.Children.map(children, this.maybeRenderChild) ?? [] : [];
const maybeBackdrop = this.maybeRenderBackdrop();
if (maybeBackdrop !== null) {
childrenWithTransitions.unshift(maybeBackdrop);
}
if (isOpen && (autoFocus || enforceFocus) && childrenWithTransitions.length > 0) {
childrenWithTransitions.unshift(
this.renderDummyElement("__start", {
className: Classes.OVERLAY_START_FOCUS_TRAP,
onFocus: this.handleStartFocusTrapElementFocus,
onKeyDown: this.handleStartFocusTrapElementKeyDown,
ref: this.refHandlers.startFocusTrap,
}),
);
if (enforceFocus) {
childrenWithTransitions.push(
this.renderDummyElement("__end", {
className: Classes.OVERLAY_END_FOCUS_TRAP,
onFocus: this.handleEndFocusTrapElementFocus,
ref: this.refHandlers.endFocusTrap,
}),
);
}
}
const containerClasses = classNames(
Classes.OVERLAY,
{
[Classes.OVERLAY_OPEN]: isOpen,
[Classes.OVERLAY_INLINE]: !usePortal,
},
className,
);
const transitionGroup = (
<TransitionGroup
appear={true}
aria-live="polite"
className={containerClasses}
component="div"
onKeyDown={this.handleKeyDown}
ref={this.refHandlers.container}
>
{childrenWithTransitions}
</TransitionGroup>
);
if (usePortal) {
return (
<Portal className={this.props.portalClassName} container={this.props.portalContainer}>
{transitionGroup}
</Portal>
);
} else {
return transitionGroup;
}
}
public componentDidMount() {
if (this.props.isOpen) {
this.overlayWillOpen();
}
}
public componentDidUpdate(prevProps: OverlayProps) {
if (prevProps.isOpen && !this.props.isOpen) {
this.overlayWillClose();
} else if (!prevProps.isOpen && this.props.isOpen) {
this.overlayWillOpen();
}
}
public componentWillUnmount() {
this.overlayWillClose();
}
/**
* @public for testing
* @internal
*/
public bringFocusInsideOverlay() {
// always delay focus manipulation to just before repaint to prevent scroll jumping
return this.requestAnimationFrame(() => {
// container ref may be undefined between component mounting and Portal rendering
// activeElement may be undefined in some rare cases in IE
const activeElement = getActiveElement(this.containerElement);
if (this.containerElement == null || activeElement == null || !this.props.isOpen) {
return;
}
const isFocusOutsideModal = !this.containerElement.contains(activeElement);
if (isFocusOutsideModal) {
this.startFocusTrapElement?.focus({ preventScroll: true });
this.isAutoFocusing = false;
}
});
}
private maybeRenderChild = (child?: React.ReactNode) => {
if (isFunction(child)) {
child = child();
}
if (child == null) {
return null;
}
// add a special class to each child element that will automatically set the appropriate
// CSS position mode under the hood.
const decoratedChild =
typeof child === "object" ? (
React.cloneElement(child as React.ReactElement, {
className: classNames((child as React.ReactElement).props.className, Classes.OVERLAY_CONTENT),
})
) : (
<span className={Classes.OVERLAY_CONTENT}>{child}</span>
);
const { onOpening, onOpened, onClosing, transitionDuration, transitionName } = this.props;
return (
<CSSTransition
classNames={transitionName}
onEntering={onOpening}
onEntered={onOpened}
onExiting={onClosing}
onExited={this.handleTransitionExited}
timeout={transitionDuration}
addEndListener={this.handleTransitionAddEnd}
>
{decoratedChild}
</CSSTransition>
);
};
private maybeRenderBackdrop() {
const { backdropClassName, backdropProps, hasBackdrop, isOpen, transitionDuration, transitionName } =
this.props;
if (hasBackdrop && isOpen) {
return (
<CSSTransition
classNames={transitionName}
key="__backdrop"
timeout={transitionDuration}
addEndListener={this.handleTransitionAddEnd}
>
<div
{...backdropProps}
className={classNames(Classes.OVERLAY_BACKDROP, backdropClassName, backdropProps?.className)}
onMouseDown={this.handleBackdropMouseDown}
/>
</CSSTransition>
);
} else {
return null;
}
}
private renderDummyElement(key: string, props: HTMLDivProps & { ref?: React.Ref<HTMLDivElement> }) {
const { transitionDuration, transitionName } = this.props;
return (
<CSSTransition
classNames={transitionName}
key={key}
addEndListener={this.handleTransitionAddEnd}
timeout={transitionDuration}
unmountOnExit={true}
>
<div tabIndex={0} {...props} />
</CSSTransition>
);
}
/**
* Ensures repeatedly pressing shift+tab keeps focus inside the Overlay. Moves focus to
* the `endFocusTrapElement` or the first keyboard-focusable element in the Overlay (excluding
* the `startFocusTrapElement`), depending on whether the element losing focus is inside the
* Overlay.
*/
private handleStartFocusTrapElementFocus = (e: React.FocusEvent<HTMLDivElement>) => {
if (!this.props.enforceFocus || this.isAutoFocusing) {
return;
}
// e.relatedTarget will not be defined if this was a programmatic focus event, as is the
// case when we call this.bringFocusInsideOverlay() after a user clicked on the backdrop.
// Otherwise, we're handling a user interaction, and we should wrap around to the last
// element in this transition group.
if (
e.relatedTarget != null &&
this.containerElement!.contains(e.relatedTarget as Element) &&
e.relatedTarget !== this.endFocusTrapElement
) {
this.endFocusTrapElement?.focus({ preventScroll: true });
}
};
/**
* Wrap around to the end of the dialog if `enforceFocus` is enabled.
*/
private handleStartFocusTrapElementKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {
if (!this.props.enforceFocus) {
return;
}
// HACKHACK: https://github.com/palantir/blueprint/issues/4165
/* eslint-disable-next-line deprecation/deprecation */
if (e.shiftKey && e.which === Keys.TAB) {
const lastFocusableElement = this.getKeyboardFocusableElements().pop();
if (lastFocusableElement != null) {
lastFocusableElement.focus();
} else {
this.endFocusTrapElement?.focus({ preventScroll: true });
}
}
};
/**
* Ensures repeatedly pressing tab keeps focus inside the Overlay. Moves focus to the
* `startFocusTrapElement` or the last keyboard-focusable element in the Overlay (excluding the
* `startFocusTrapElement`), depending on whether the element losing focus is inside the
* Overlay.
*/
private handleEndFocusTrapElementFocus = (e: React.FocusEvent<HTMLDivElement>) => {
// No need for this.props.enforceFocus check here because this element is only rendered
// when that prop is true.
// During user interactions, e.relatedTarget will be defined, and we should wrap around to the
// "start focus trap" element.
// Otherwise, we're handling a programmatic focus event, which can only happen after a user
// presses shift+tab from the first focusable element in the overlay.
if (
e.relatedTarget != null &&
this.containerElement!.contains(e.relatedTarget as Element) &&
e.relatedTarget !== this.startFocusTrapElement
) {
const firstFocusableElement = this.getKeyboardFocusableElements().shift();
// ensure we don't re-focus an already active element by comparing against e.relatedTarget
if (!this.isAutoFocusing && firstFocusableElement != null && firstFocusableElement !== e.relatedTarget) {
firstFocusableElement.focus();
} else {
this.startFocusTrapElement?.focus({ preventScroll: true });
}
} else {
const lastFocusableElement = this.getKeyboardFocusableElements().pop();
if (lastFocusableElement != null) {
lastFocusableElement.focus();
} else {
// Keeps focus within Overlay even if there are no keyboard-focusable children
this.startFocusTrapElement?.focus({ preventScroll: true });
}
}
};
private getKeyboardFocusableElements() {
const focusableElements: HTMLElement[] =
this.containerElement !== null
? Array.from(
// Order may not be correct if children elements use tabindex values > 0.
// Selectors derived from this SO question:
// https://stackoverflow.com/questions/1599660/which-html-elements-can-receive-focus
this.containerElement.querySelectorAll(
[
'a[href]:not([tabindex="-1"])',
'button:not([disabled]):not([tabindex="-1"])',
'details:not([tabindex="-1"])',
'input:not([disabled]):not([tabindex="-1"])',
'select:not([disabled]):not([tabindex="-1"])',
'textarea:not([disabled]):not([tabindex="-1"])',
'[tabindex]:not([tabindex="-1"])',
].join(","),
),
)
: [];
return focusableElements.filter(
el =>
!el.classList.contains(Classes.OVERLAY_START_FOCUS_TRAP) &&
!el.classList.contains(Classes.OVERLAY_END_FOCUS_TRAP),
);
}
private overlayWillClose() {
document.removeEventListener("focus", this.handleDocumentFocus, /* useCapture */ true);
document.removeEventListener("mousedown", this.handleDocumentClick);
const { openStack } = Overlay;
const stackIndex = openStack.indexOf(this);
if (stackIndex !== -1) {
openStack.splice(stackIndex, 1);
if (openStack.length > 0) {
const lastOpenedOverlay = Overlay.getLastOpened();
// Only bring focus back to last overlay if it had autoFocus _and_ enforceFocus enabled.
// If `autoFocus={false}`, it's likely that the overlay never received focus in the first place,
// so it would be surprising for us to send it there. See https://github.com/palantir/blueprint/issues/4921
if (lastOpenedOverlay.props.autoFocus && lastOpenedOverlay.props.enforceFocus) {
lastOpenedOverlay.bringFocusInsideOverlay();
document.addEventListener("focus", lastOpenedOverlay.handleDocumentFocus, /* useCapture */ true);
}
}
if (openStack.filter(o => o.props.usePortal && o.props.hasBackdrop).length === 0) {
document.body.classList.remove(Classes.OVERLAY_OPEN);
}
}
}
private overlayWillOpen() {
const { getLastOpened, openStack } = Overlay;
if (openStack.length > 0) {
document.removeEventListener("focus", getLastOpened().handleDocumentFocus, /* useCapture */ true);
}
openStack.push(this);
if (this.props.autoFocus) {
this.isAutoFocusing = true;
this.bringFocusInsideOverlay();
}
if (this.props.enforceFocus) {
// Focus events do not bubble, but setting useCapture allows us to listen in and execute
// our handler before all others
document.addEventListener("focus", this.handleDocumentFocus, /* useCapture */ true);
}
if (this.props.canOutsideClickClose && !this.props.hasBackdrop) {
document.addEventListener("mousedown", this.handleDocumentClick);
}
if (this.props.hasBackdrop && this.props.usePortal) {
// add a class to the body to prevent scrolling of content below the overlay
document.body.classList.add(Classes.OVERLAY_OPEN);
}
this.lastActiveElementBeforeOpened = getActiveElement(this.containerElement);
}
private handleTransitionExited = (node: HTMLElement) => {
if (this.props.shouldReturnFocusOnClose && this.lastActiveElementBeforeOpened instanceof HTMLElement) {
this.lastActiveElementBeforeOpened.focus();
}
this.props.onClosed?.(node);
};
private handleBackdropMouseDown = (e: React.MouseEvent<HTMLDivElement>) => {
const { backdropProps, canOutsideClickClose, enforceFocus, onClose } = this.props;
if (canOutsideClickClose) {
onClose?.(e);
}
if (enforceFocus) {
this.bringFocusInsideOverlay();
}
backdropProps?.onMouseDown?.(e);
};
private handleDocumentClick = (e: MouseEvent) => {
const { canOutsideClickClose, isOpen, onClose } = this.props;
// get the actual target even in the Shadow DOM
const eventTarget = (e.composed ? e.composedPath()[0] : e.target) as HTMLElement;
const stackIndex = Overlay.openStack.indexOf(this);
const isClickInThisOverlayOrDescendant = Overlay.openStack
.slice(stackIndex)
.some(({ containerElement: elem }) => {
// `elem` is the container of backdrop & content, so clicking on that container
// should not count as being "inside" the overlay.
return elem && elem.contains(eventTarget) && !elem.isSameNode(eventTarget);
});
if (isOpen && !isClickInThisOverlayOrDescendant && canOutsideClickClose) {
// casting to any because this is a native event
onClose?.(e as any);
}
};
/**
* When multiple Overlays are open, this event handler is only active for the most recently
* opened one to avoid Overlays competing with each other for focus.
*/
private handleDocumentFocus = (e: FocusEvent) => {
// get the actual target even in the Shadow DOM
const eventTarget = e.composed ? e.composedPath()[0] : e.target;
if (
this.props.enforceFocus &&
this.containerElement != null &&
eventTarget instanceof Node &&
!this.containerElement.contains(eventTarget as HTMLElement)
) {
// prevent default focus behavior (sometimes auto-scrolls the page)
e.preventDefault();
e.stopImmediatePropagation();
this.bringFocusInsideOverlay();
}
};
private handleKeyDown = (e: React.KeyboardEvent<HTMLElement>) => {
const { canEscapeKeyClose, onClose } = this.props;
if (e.key === "Escape" && canEscapeKeyClose) {
onClose?.(e);
// prevent other overlays from closing
e.stopPropagation();
// prevent browser-specific escape key behavior (Safari exits fullscreen)
e.preventDefault();
}
};
private handleTransitionAddEnd = () => {
// no-op
};
}