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

Function onFocus

packages/react-aria/src/datepicker/useDateSegment.ts:253–262  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

251 };
252
253 let onFocus = () => {
254 enteredKeys.current = '';
255 if (ref.current) {
256 scrollIntoViewport(ref.current, {containingElement: getScrollParent(ref.current)});
257 }
258
259 // Collapse selection to start or Chrome won't fire input events.
260 let selection = window.getSelection();
261 selection?.collapse(ref.current);
262 };
263
264 let documentRef = useRef(typeof document !== 'undefined' ? document : null);
265 useEvent(documentRef, 'selectionchange', () => {

Callers

nothing calls this directly

Calls 3

scrollIntoViewportFunction · 0.90
getScrollParentFunction · 0.90
collapseMethod · 0.65

Tested by

no test coverage detected