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

Function onMouseUp

packages/react-aria/src/interactions/usePress.ts:787–810  ·  view source on GitHub ↗
(e: MouseEvent)

Source from the content-addressed store, hash-verified

785 };
786
787 let onMouseUp = (e: MouseEvent) => {
788 // Only handle left clicks
789 if (e.button !== 0) {
790 return;
791 }
792
793 if (state.ignoreEmulatedMouseEvents) {
794 state.ignoreEmulatedMouseEvents = false;
795 return;
796 }
797
798 if (
799 state.target &&
800 nodeContains(state.target, getEventTarget(e) as Element) &&
801 state.pointerType != null
802 ) {
803 // Wait for onClick to fire onPress. This avoids browser issues when the DOM
804 // is mutated between onMouseUp and onClick, and is more compatible with third party libraries.
805 } else {
806 cancelEvent(e);
807 }
808
809 state.isOverTarget = false;
810 };
811
812 pressProps.onTouchStart = e => {
813 if (!nodeContains(e.currentTarget, getEventTarget(e))) {

Callers

nothing calls this directly

Calls 2

nodeContainsFunction · 0.90
getEventTargetFunction · 0.90

Tested by

no test coverage detected