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

Function onPressUp

packages/react-aria/src/menu/useMenuItem.ts:240–254  ·  view source on GitHub ↗
(e: PressEvent)

Source from the content-addressed store, hash-verified

238
239 let interaction = useRef<{pointerType: string; key?: string} | null>(null);
240 let onPressUp = (e: PressEvent) => {
241 if (e.pointerType !== 'keyboard') {
242 interaction.current = {pointerType: e.pointerType};
243 }
244
245 // If interacting with mouse, allow the user to mouse down on the trigger button,
246 // drag, and release over an item (matching native behavior).
247 if (e.pointerType === 'mouse') {
248 if (!isPressedRef.current) {
249 (e.target as HTMLElement).click();
250 }
251 }
252
253 pressUpProp?.(e);
254 };
255
256 let onClick = (e: MouseEvent<FocusableElement>) => {
257 onClickProp?.(e);

Callers 1

usePressFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected