MCPcopy Create free account
hub / github.com/adobe/react-spectrum / focusLast

Function focusLast

packages/react-aria/src/focus/FocusScope.tsx:271–282  ·  view source on GitHub ↗
(opts = {})

Source from the content-addressed store, hash-verified

269 return nextNode;
270 },
271 focusLast(opts = {}) {
272 let scope = scopeRef.current!;
273 let {tabbable, accept} = opts;
274 let scopeRoot = getScopeRoot(scope);
275 let walker = getFocusableTreeWalker(scopeRoot, {tabbable, accept}, scope);
276 walker.currentNode = scope[scope.length - 1].nextElementSibling!;
277 let previousNode = walker.previousNode() as FocusableElement;
278 if (previousNode) {
279 focusElement(previousNode, true);
280 }
281 return previousNode;
282 }
283 };
284}
285

Callers

nothing calls this directly

Calls 5

getScopeRootFunction · 0.85
getFocusableTreeWalkerFunction · 0.85
focusElementFunction · 0.85
previousNodeMethod · 0.80
lastFunction · 0.70

Tested by

no test coverage detected