fix(overlay): add overlay lifecycle methods to stack management #1393
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
overlayWillOpenCallback
marks the beginning of the open cycle. by default this is followed in a few short frames with the actual opening of the overlay and in this way can be seen as equivalent to anoverlayOpenedCallback
for most concerns)overlayOpenCancelledCallback
takes into account overlay content that isdelayed
(usually tooltips) and could have their open process cancelled.overlayCloseCallback
handles when the entire cycle is complete and only can occur for overlays that had not previously calledoverlayOpenCancelledCallback
.options
argument with{ trigger: HTMLElement }
(to support expanding to more options as needed in the future) and returnsvoid
sp-tooltip
element to appropriate hang content in the origin location to be used for accessibility while the actualsp-tooltip
element is in "overlay" position and not accessible via IDREFs.sp-tooltip
'stextContent
and appropriatearia
attributes across the overlay experience to ensure that thetrigger
is "described by" the tooltip.overlay-trigger
now handles anabortOverlay
promise forhover-content
so that in the likelihood that said content isdelayed
the warmup time can be cancelled appropriately.Alternative
Right now we dispatch
sp-opened
andsp-closed
events on thetrigger
element of the overlay feature. We would be similarly served as the above were we to dispatch the same events on thecontent
elements as well and leverage event listeners rather than direct method calls. We could placebubbles: false
on one of those dispatches to prevent bubble phases on both events, but we would still have capture phases on both which means that elements that might listen to these events above might face challenges disambiguating one event from the other. In this way we could dispatch more specific eventssp-opened
andsp-content-opened
or more specificdetail
packages:vs:
However, there is something to be said about the pseudo "privacy" of this approach, as well as its relation to the custom element and LitElement usage of lifecycle methods.
Related Issue
fixes #1078
Motivation and Context
More accessible tooltips.
More capable overlay system.
World peace?
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: