@@ -297,7 +297,6 @@ class MenuSubmenuIntent {
297297
298298 const onContentLeave = ( e : PointerEvent ) => {
299299 if ( ! isMouseEvent ( e ) ) return ;
300- // don't start return-tracking when leaving into a child sub-content
301300 if ( isElement ( e . relatedTarget ) ) {
302301 const selector = this . #opts. subContentSelector ( ) ;
303302 const matchedSubContent = e . relatedTarget . closest ( selector ) ;
@@ -319,13 +318,11 @@ class MenuSubmenuIntent {
319318
320319 const onTriggerEnter = ( e : PointerEvent ) => {
321320 if ( ! isMouseEvent ( e ) ) return ;
322- // arrived at trigger, transit complete
323321 this . #disengage( ) ;
324322 } ;
325323
326324 const onContentEnter = ( e : PointerEvent ) => {
327325 if ( ! isMouseEvent ( e ) ) return ;
328- // arrived at content, transit complete
329326 this . #disengage( ) ;
330327 } ;
331328
@@ -405,10 +402,6 @@ class MenuSubmenuIntent {
405402 return isPointInPolygon ( pt , corridor ) || isPointInPolygon ( pt , intent ) ;
406403 }
407404
408- /**
409- * When the pointer hovers over the trigger or content, we start previewing the transit.
410- * This is used to show the debug overlay while hovering the trigger or content.
411- */
412405 #preview( e : PointerEvent , target : IntentTarget ) {
413406 const pt = { x : e . clientX , y : e . clientY } ;
414407 const geo = this . #computePolygons( pt , target ) ;
@@ -421,17 +414,13 @@ class MenuSubmenuIntent {
421414 this . #syncDebug( ) ;
422415 }
423416
424- /**
425- * When the pointer leaves the trigger or content, we start actively tracking the transit.
426- */
427417 #engage( e : PointerEvent , target : IntentTarget ) {
428418 if ( ! this . #opts. enabled ( ) ) return ;
429419
430420 const triggerNode = this . #opts. triggerNode ( ) ;
431421 const contentNode = this . #opts. contentNode ( ) ;
432422 if ( ! triggerNode || ! contentNode ) return ;
433423
434- // pointer moved directly into the destination — no transit needed
435424 const related = e . relatedTarget ;
436425 if ( isElement ( related ) ) {
437426 if ( target === "content" && contentNode . contains ( related ) ) return ;
@@ -440,16 +429,13 @@ class MenuSubmenuIntent {
440429
441430 const pt = { x : e . clientX , y : e . clientY } ;
442431
443- // immediately check if pointer is already outside the safe zone
444- // (e.g. moving downward to a sibling instead of toward the content)
445432 const geo = this . #computePolygons( pt , target ) ;
446433 if ( ! geo ) return ;
447434
448435 if (
449436 ! isInsideRect ( pt , geo . targetRect ) &&
450437 ! this . #isInSafeZone( pt , geo . corridor , geo . intent )
451438 ) {
452- // pointer left toward somewhere outside the safe zone — don't engage
453439 this . #clearVisuals( ) ;
454440 return ;
455441 }
@@ -468,9 +454,6 @@ class MenuSubmenuIntent {
468454
469455 #disengageTimer: ReturnType < typeof setTimeout > | null = null ;
470456
471- /**
472- * When the pointer arrives at the destination, we stop tracking the transit.
473- */
474457 #disengage( ) {
475458 if ( ! this . #active) return ;
476459 const wasReturning = this . #target === "trigger" ;
@@ -480,8 +463,6 @@ class MenuSubmenuIntent {
480463 this . #clearVisuals( ) ;
481464
482465 if ( wasReturning ) {
483- // keep isPointerInTransit true briefly so the pointer can settle on the
484- // trigger without accidentally opening a neighboring sub-trigger
485466 this . #clearDisengageTimer( ) ;
486467 this . #disengageTimer = setTimeout ( ( ) => {
487468 this . #disengageTimer = null ;
@@ -498,9 +479,6 @@ class MenuSubmenuIntent {
498479 this . #disengageTimer = null ;
499480 }
500481
501- /**
502- * When the pointer leaves the safe zone, we close the submenu.
503- */
504482 #intentExit( ) {
505483 this . #detachDocMove( ) ;
506484 this . #clearFallback( ) ;
@@ -511,9 +489,6 @@ class MenuSubmenuIntent {
511489 this . #opts. onIntentExit ( ) ;
512490 }
513491
514- /**
515- * When the node changes or the component is destroyed, we reset the state.
516- */
517492 #reset( ) {
518493 this . #detachDocMove( ) ;
519494 this . #clearFallback( ) ;
@@ -529,9 +504,6 @@ class MenuSubmenuIntent {
529504 this . #syncDebug( ) ;
530505 }
531506
532- /**
533- * When the pointer moves over the document, we track the transit.
534- */
535507 #isPointerInDescendantSubContent( pt : Point ) : boolean {
536508 const contentNode = this . #opts. contentNode ( ) ;
537509 if ( ! contentNode ) return false ;
@@ -541,9 +513,6 @@ class MenuSubmenuIntent {
541513 const selector = this . #opts. subContentSelector ( ) ;
542514 const subContent = el . closest ( selector ) ;
543515 if ( ! subContent || subContent === contentNode ) return false ;
544- // verify this sub-content was triggered from within our content by checking
545- // if a sub-trigger with aria-controls matching the sub-content's id exists
546- // inside our content node
547516 if ( subContent . id ) return ! ! contentNode . querySelector ( `[aria-controls="${ subContent . id } "]` ) ;
548517 return false ;
549518 }
@@ -563,7 +532,6 @@ class MenuSubmenuIntent {
563532 const pt = { x : e . clientX , y : e . clientY } ;
564533 this . #pointerPoint = pt ;
565534
566- // check if pointer arrived at the destination element
567535 const triggerRect = triggerNode . getBoundingClientRect ( ) ;
568536 const contentRect = contentNode . getBoundingClientRect ( ) ;
569537 if ( this . #target === "content" && isInsideRect ( pt , contentRect ) ) {
@@ -575,13 +543,11 @@ class MenuSubmenuIntent {
575543 return ;
576544 }
577545
578- // pointer is inside a child sub-content portal, treat as safe, don't close
579546 if ( this . #isPointerInDescendantSubContent( pt ) ) {
580547 this . #startFallback( ) ;
581548 return ;
582549 }
583550
584- // recompute safe zone from the locked apex
585551 const geo = this . #computePolygons( pt , this . #target) ;
586552 if ( ! geo ) {
587553 this . #intentExit( ) ;
@@ -615,9 +581,6 @@ class MenuSubmenuIntent {
615581 this . #cleanupDocMove?.( ) ;
616582 }
617583
618- /**
619- * When the pointer goes completely still mid-transit, we close the submenu.
620- */
621584 #startFallback( ) {
622585 this . #clearFallback( ) ;
623586 this . #fallbackTimer = setTimeout ( ( ) => {
@@ -770,8 +733,6 @@ function getIntentPolygon(
770733 const edgeBuffer = 8 ;
771734 const effectiveSide = target === "trigger" ? flipSide ( side ) : side ;
772735
773- // when returning to trigger, the base edge should span the full extent
774- // of both the source (submenu content) and the target (parent content)
775736 const top = sourceRect
776737 ? Math . min ( targetRect . top , sourceRect . top ) - edgeBuffer
777738 : targetRect . top - edgeBuffer ;
@@ -1176,7 +1137,6 @@ export class MenuContentState {
11761137 dir : this . parentMenu . root . opts . dir . current ,
11771138 style : {
11781139 pointerEvents : "auto" ,
1179- // CSS containment isolates style/layout/paint calculations from the rest of the page
11801140 contain : "layout style" ,
11811141 } ,
11821142 ...this . attachment ,
@@ -1969,7 +1929,6 @@ export class ContextMenuTriggerState {
19691929 "data-state" : getDataOpenClosed ( this . parentMenu . opts . open . current ) ,
19701930 [ CONTEXT_MENU_TRIGGER_ATTR ] : "" ,
19711931 tabindex : - 1 ,
1972- //
19731932 onpointerdown : this . onpointerdown ,
19741933 onpointermove : this . onpointermove ,
19751934 onpointercancel : this . onpointercancel ,
0 commit comments