You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -269,7 +269,7 @@ Some Overlays will always be passed focus (e.g. modal or page Overlays). When th
269
269
270
270
The `trigger` option accepts an `HTMLElement` or a `VirtualTrigger` from which to position the Overlay.
271
271
272
-
-You can import the `VirtualTrigger` class from the overlay package to create a virtual trigger that can be used to position an Overlay. This is useful when you want to position an Overlay relative to a point on the screen that is not an element in the DOM, like the mouse cursor.
272
+
- You can import the `VirtualTrigger` class from the overlay package to create a virtual trigger that can be used to position an Overlay. This is useful when you want to position an Overlay relative to a point on the screen that is not an element in the DOM, like the mouse cursor.
273
273
274
274
The `type` of an Overlay outlines a number of things about the interaction model within which it works:
275
275
@@ -408,8 +408,8 @@ The `overlay` value in this case will hold a reference to the actual `<sp-overla
408
408
409
409
"Fully" in this context means that all CSS transitions that have dispatched `transitionrun` events on the direct children of the `<sp-overlay>` element have successfully dispatched their `transitionend` or `transitioncancel` event. Keep in mind the following:
410
410
411
-
-`transition*` events bubble; this means that while transition events on light DOM content of those direct children will be heard, those events will not be taken into account
412
-
-`transition*` events are not composed; this means that transition events on shadow DOM content of the direct children will not propagate to a level in the DOM where they can be heard
411
+
-`transition*` events bubble; this means that while transition events on light DOM content of those direct children will be heard, those events will not be taken into account
412
+
-`transition*` events are not composed; this means that transition events on shadow DOM content of the direct children will not propagate to a level in the DOM where they can be heard
413
413
414
414
This means that in both cases, if the transition is meant to be a part of the opening or closing of the overlay in question you will need to re-dispatch the `transitionrun`, `transitionend`, and `transitioncancel` events from that transition from the closest direct child of the `<sp-overlay>`.
415
415
@@ -573,7 +573,136 @@ Common in `modal`/`page` overlays for full-screen content</sp-table-cell>
`'modal'`Overlaysareopenedwiththe`showModal()`methodona`<dialog>`element, which causes the Overlay to accept focus and trap the tab stop within the content of said Overlay.
581
+
582
+
They should be used when you need to ensure that the user has interacted with the content of the Overlay before continuing with their work. This is commonly used for dialogs that require a user to confirm or cancel an action before continuing.
`'page'` Overlays will act in a similar manner to a `'modal'` Overlay, however they will not be allowed to close via the "light dismiss" algorithm (e.g. the Escape key).
610
+
611
+
A page overlay could be used for a full-screen menu on a mobile website. When the user clicks on the menu button, the entire screen is covered with the menu options.
612
+
613
+
```html
614
+
<sp-button id="trigger">open page</sp-button>
615
+
<sp-overlay trigger="trigger@click" type="page">
616
+
<sp-dialog-wrapper
617
+
headline="Full screen menu"
618
+
mode="fullscreenTakeover"
619
+
cancel-label="Close"
620
+
>
621
+
<p>I am a page type overlay.</p>
622
+
</sp-dialog-wrapper>
623
+
</sp-overlay>
624
+
```
625
+
626
+
### Hint
627
+
628
+
`'hint'` Overlays are much like tooltips so they are not just ephemeral, but they are delivered primarily as a visual helper and exist outside of the tab order. In this way, be sure _not_ to place interactive content within this type of Overlay.
629
+
630
+
This overlay type does not accept focus and does not interfere with the user's interaction with the rest of the page.
631
+
632
+
```html
633
+
<sp-button id="trigger">open hint</sp-button>
634
+
<sp-overlay trigger="trigger@hover" type="hint">
635
+
<sp-tooltip>
636
+
I am a hint type overlay. I am not interactive and will close when the
637
+
user interacts with the page.
638
+
</sp-tooltip>
639
+
</sp-overlay>
640
+
```
641
+
642
+
### Auto
643
+
644
+
`'auto'` Overlays provide a place for content that is ephemeral _and_ interactive. These Overlays can accept focus and remain open while interacting with their content. They will close when focus moves outside the overlay or when clicking elsewhere on the page.
<sp-textfield placeholder="Enter your message"></sp-textfield>
678
+
<sp-action-button>Send</sp-action-button>
679
+
</sp-dialog>
680
+
</sp-popover>
681
+
</sp-overlay>
682
+
```
683
+
684
+
### Events
685
+
686
+
When fully open the `<sp-overlay>` element will dispatch the `sp-opened` event, and when fully closed the `sp-closed` event will be dispatched. Both of these events are of type:
687
+
688
+
```ts
689
+
type OverlayStateEvent = Event & {
690
+
overlay: Overlay;
691
+
};
692
+
```
693
+
694
+
The`overlay`valueinthiscasewillholdareferencetotheactual`<sp-overlay>`thatisopeningorclosingtotriggerthisevent. Rememberthatsome`<sp-overlay>`element (likethosecreatesviatheimperativeAPI) canbetransientlyavailableintheDOM, so if you choose to build a cache of Overlay elements to some end, be sure to leverage a weak reference so that the `<sp-overlay>` can be garbage collected as desired by the browser.
695
+
696
+
#### When it is "fully" open or closed?
697
+
698
+
"Fully" in this context means that all CSS transitions that have dispatched `transitionrun` events on the direct children of the `<sp-overlay>` element have successfully dispatched their `transitionend` or `transitioncancel` event. Keep in mind the following:
699
+
700
+
-`transition*`eventsbubble; thismeansthatwhiletransitioneventsonlightDOMcontentofthosedirectchildrenwillbeheard, those events will not be taken into account
701
+
- `transition*` events are not composed; this means that transition events on shadow DOM content of the direct children will not propagate to a level in the DOM where they can be heard
702
+
703
+
This means that in both cases, if the transition is meant to be a part of the opening or closing of the overlay in question you will need to redispatch the `transitionrun`, `transitionend`, and `transitioncancel` events from that transition from the closest direct child of the `<sp-overlay>`.
704
+
705
+
## Styling
577
706
578
707
`<sp-overlay>` element will use the `<dialog>` element or `popover` attribute to project your content onto the top-layer of the browser, without being moved in the DOM tree. That means that you can style your overlay content with whatever techniques you are already leveraging to style the content that doesn't get overlaid. This means standard CSS selectors, CSS Custom Properties, and CSS Parts applied in your parent context will always apply to your overlaid content.
579
708
@@ -772,9 +901,9 @@ When nesting multiple overlays, it is important to ensure that the nested overla
0 commit comments