@@ -837,20 +837,22 @@ const PressResponder: ReactDOMEventResponder = {
837837 }
838838 const pressTarget = state . pressTarget ;
839839
840- if (
841- pressTarget !== null &&
842- ! targetIsDocument ( pressTarget ) &&
843- ( pointerType !== 'mouse' ||
844- ! context . isTargetWithinNode ( target , pressTarget ) )
845- ) {
846- // Calculate the responder region we use for deactivation, as the
847- // element dimensions may have changed since activation.
848- updateIsPressWithinResponderRegion (
849- touchEvent || nativeEvent ,
850- context ,
851- props ,
852- state ,
853- ) ;
840+ if ( pressTarget !== null && ! targetIsDocument ( pressTarget ) ) {
841+ if (
842+ pointerType === 'mouse' &&
843+ context . isTargetWithinNode ( target , pressTarget )
844+ ) {
845+ state . isPressWithinResponderRegion = true ;
846+ } else {
847+ // Calculate the responder region we use for deactivation, as the
848+ // element dimensions may have changed since activation.
849+ updateIsPressWithinResponderRegion (
850+ touchEvent || nativeEvent ,
851+ context ,
852+ props ,
853+ state ,
854+ ) ;
855+ }
854856 }
855857
856858 if ( state . isPressWithinResponderRegion ) {
@@ -958,19 +960,24 @@ const PressResponder: ReactDOMEventResponder = {
958960 if (
959961 ! isKeyboardEvent &&
960962 pressTarget !== null &&
961- ! targetIsDocument ( pressTarget ) &&
962- ( pointerType !== 'mouse' ||
963- ! context . isTargetWithinNode ( target , pressTarget ) )
963+ ! targetIsDocument ( pressTarget )
964964 ) {
965- // If the event target isn't within the press target, check if we're still
966- // within the responder region. The region may have changed if the
967- // element's layout was modified after activation.
968- updateIsPressWithinResponderRegion (
969- touchEvent || nativeEvent ,
970- context ,
971- props ,
972- state ,
973- ) ;
965+ if (
966+ pointerType === 'mouse' &&
967+ context . isTargetWithinNode ( target , pressTarget )
968+ ) {
969+ state . isPressWithinResponderRegion = true ;
970+ } else {
971+ // If the event target isn't within the press target, check if we're still
972+ // within the responder region. The region may have changed if the
973+ // element's layout was modified after activation.
974+ updateIsPressWithinResponderRegion (
975+ touchEvent || nativeEvent ,
976+ context ,
977+ props ,
978+ state ,
979+ ) ;
980+ }
974981 }
975982 if ( state . isPressWithinResponderRegion && button !== 1 ) {
976983 if (
0 commit comments