MCPcopy Create free account
hub / github.com/reactjs/react-modal / returnFocus

Function returnFocus

src/helpers/focusManager.js:56–73  ·  view source on GitHub ↗
(preventScroll = false)

Source from the content-addressed store, hash-verified

54
55/* eslint-disable no-console */
56export function returnFocus(preventScroll = false) {
57 let toFocus = null;
58 try {
59 if (focusLaterElements.length !== 0) {
60 toFocus = focusLaterElements.pop();
61 toFocus.focus({ preventScroll });
62 }
63 return;
64 } catch (e) {
65 console.warn(
66 [
67 "You tried to return focus to",
68 toFocus,
69 "but it is not in the DOM anymore"
70 ].join(" ")
71 );
72 }
73}
74/* eslint-enable no-console */
75
76export function popWithoutFocus() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…