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

Function onPress

packages/react-aria/src/menu/useMenuTrigger.ts:136–143  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

134 }
135 },
136 onPress(e) {
137 if (e.pointerType === 'touch' && !isDisabled) {
138 // Ensure trigger has focus before opening the menu so it can be restored by FocusScope on close.
139 focusWithoutScrolling(e.target as FocusableElement);
140
141 state.toggle();
142 }
143 }
144 };
145
146 // omit onPress from triggerProps since we override it above.

Callers

nothing calls this directly

Calls 2

focusWithoutScrollingFunction · 0.90
toggleMethod · 0.65

Tested by

no test coverage detected