-
Notifications
You must be signed in to change notification settings - Fork 235
Closed
Labels
Description
Expected Behaviour
We should have a way to manually open or control overlays.
Actual Behaviour
Right now the only easy way to open an overlay is to use an overlay-trigger. However, not all use cases of overlays are triggered by click or hover events.
Reproduce Scenario (including but not limited to)
Steps to Reproduce
Platform and Version
Sample Code that illustrates the problem
Right now you have to write code like this to manually open an overlay:
spectrum-web-components/documentation/src/components/side-nav-search.ts
Lines 74 to 115 in 83e4151
| private openPopover() { | |
| if (!this.popover) return; | |
| const overlayOpenDetail: OverlayOpenDetail = { | |
| content: this.popover, | |
| delay: 0, | |
| offset: 10, | |
| placement: 'bottom', | |
| trigger: this, | |
| interaction: 'click', | |
| }; | |
| const overlayOpenEvent = new CustomEvent<OverlayOpenDetail>( | |
| 'sp-overlay:open', | |
| { | |
| bubbles: true, | |
| composed: true, | |
| detail: overlayOpenDetail, | |
| } | |
| ); | |
| this.dispatchEvent(overlayOpenEvent); | |
| } | |
| private closePopover() { | |
| if (!this.popover) return; | |
| const overlayCloseDetail: OverlayCloseDetail = { | |
| content: this.popover, | |
| }; | |
| const overlayCloseEvent = new CustomEvent<OverlayCloseDetail>( | |
| 'sp-overlay:close', | |
| { | |
| bubbles: true, | |
| composed: true, | |
| detail: overlayCloseDetail, | |
| } | |
| ); | |
| this.dispatchEvent(overlayCloseEvent); | |
| } |