@@ -22,6 +22,10 @@ import '@spectrum-web-components/textfield/sp-textfield.js';
2222import '@spectrum-web-components/action-button/sp-action-button.js' ;
2323import { Placement } from '@spectrum-web-components/overlay' ;
2424import '@spectrum-web-components/overlay/sp-overlay.js' ;
25+ import '@spectrum-web-components/popover/sp-popover.js' ;
26+ import '@spectrum-web-components/overlay/overlay-trigger.js' ;
27+ // Import Overlay type for type casting
28+ import type { Overlay } from '@spectrum-web-components/overlay' ;
2529
2630const iconOptions : {
2731 [ key : string ] : ( {
@@ -454,3 +458,100 @@ draggable.parameters = {
454458 // Disables Chromatic's snapshotting on a global level
455459 chromatic : { disableSnapshot : true } ,
456460} ;
461+
462+ export const DelayedTooltipWithOverlay = ( ) : TemplateResult => {
463+ return html `
464+ < div
465+ style ="width: 100%; max-width: 800px; margin: 0 auto; padding: 20px; "
466+ >
467+ < h2 > Delayed Tooltip Overlay Interaction Issue</ h2 >
468+
469+ < div style ="display: flex; gap: 24px; margin-bottom: 24px; ">
470+ <!-- First overlay - this should stay open during tooltip warmup -->
471+ < sp-button variant ="primary " id ="button1 ">
472+ Click to Open Popover
473+ </ sp-button >
474+ < sp-overlay
475+ trigger ="button1@click "
476+ placement ="bottom "
477+ id ="popover-overlay "
478+ >
479+ < sp-popover >
480+ < div style ="padding: 20px; ">
481+ < h3 style ="margin-top: 0; "> Opened Popover</ h3 >
482+ < p >
483+ This popover should stay open during tooltip
484+ warmup
485+ </ p >
486+ < p >
487+ < strong > Steps to test:</ strong >
488+ With this popover open, hover the button to the
489+ right.
490+ </ p >
491+ </ div >
492+ </ sp-popover >
493+ </ sp-overlay >
494+
495+ < overlay-trigger triggered-by ="hover ">
496+ < sp-button
497+ slot ="trigger "
498+ variant ="secondary "
499+ @pointerenter =${ ( event : Event ) => {
500+ // Capture phase event handler to stop propagation during warmup
501+ // This ensures other overlays don't close prematurely
502+ event . stopPropagation ( ) ;
503+ } }
504+ >
505+ Hover me
506+ </ sp-button >
507+ < sp-tooltip
508+ slot ="hover-content "
509+ delayed
510+ placement ="bottom "
511+ @sp-opened =${ ( ) => {
512+ const popoverOverlay = document . getElementById (
513+ 'popover-overlay'
514+ ) as Overlay ;
515+ if (
516+ popoverOverlay &&
517+ popoverOverlay . hasAttribute ( 'open' )
518+ ) {
519+ popoverOverlay . open = false ;
520+ }
521+ } }
522+ >
523+ This is a delayed tooltip
524+ </ sp-tooltip >
525+ </ overlay-trigger >
526+ </ div >
527+
528+ < div
529+ style ="border: 1px solid #ccc; padding: 20px; border-radius: 4px; background-color: #f5f5f5; "
530+ >
531+ < h3 style ="margin-top: 0; "> Expected Behavior</ h3 >
532+ < ol style ="margin-left: 16px; ">
533+ < li >
534+ Click the
535+ < strong > Click to Open Popover</ strong >
536+ button to open the popover
537+ </ li >
538+ < li >
539+ Hover over the
540+ < strong > Hover me</ strong >
541+ button
542+ </ li >
543+ < li >
544+ The popover should
545+ < strong > remain open</ strong >
546+ during the tooltip's 1-second warmup period
547+ </ li >
548+ < li >
549+ The popover should
550+ < strong > automatically close</ strong >
551+ when the tooltip appears in DOM
552+ </ li >
553+ </ ol >
554+ </ div >
555+ </ div >
556+ ` ;
557+ } ;
0 commit comments