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

Function onFocus

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

Source from the content-addressed store, hash-verified

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