MCPcopy Index your code
hub / github.com/adobe/react-spectrum / onFocus

Function onFocus

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

Source from the content-addressed store, hash-verified

255 };
256
257 let onFocus = () => {
258 enteredKeys.current = '';
259 if (ref.current) {
260 scrollIntoViewport(ref.current, {containingElement: getScrollParent(ref.current)});
261 }
262
263 // Collapse selection to start or Chrome won't fire input events.
264 let selection = window.getSelection();
265 selection?.collapse(ref.current);
266 };
267
268 let documentRef = useRef(typeof document !== 'undefined' ? document : null);
269 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