[Feat]: Abstract Overlay API Review
See original GitHub issueCode of conduct
- I agree to follow this project’s code of conduct.
Impacted component(s)
overlay
Description of the requested feature
openOverlay currently accepts:
{
target: HTMLElement,
interaction:
| 'click'
| 'longpress'
| 'hover'
| 'custom'
| 'replace'
| 'inline'
| 'modal',
content: HTMLElement,
options: {
delayed?: boolean;
placement?: Placement;
offset?: number;
receivesFocus?: 'auto';
notImmediatelyClosable?: boolean;
abortPromise?: Promise<boolean>;
virtualTrigger?: VirtualTrigger;
}
}
A content element managed for overlay looks like:
interface ManagedOverlayContent {
open: boolean;
overlayWillOpenCallback?: (args: { trigger: HTMLElement }) => void;
overlayOpenCallback?: (args: { trigger: HTMLElement }) => void;
overlayOpenCancelledCallback?: (args: { trigger: HTMLElement }) => void;
overlayCloseCallback?: (args: { trigger: HTMLElement }) => void;
}
Important question
If we created a new API could we smooth transition by wrapping it with the old API for the initial term?
Things we might want instead:
content
is required but trigger
is not
- points to a usage of the “Active Stack” concept where the “trigger” was the previous “active element” and that content would manage things like theme, focus return, etc.
tabOrder: ‘none’ | ‘inline’ | ‘replace’ | ‘trap’
- ‘none’ = tooltip and similar that are given
aria-*
based content relations - ‘inline’ = before trigger <=> trigger <=> overlay <=> after overlay
- ‘replace’ = before trigger <=> trigger when closed, overlay when open <=> after overlay
- ‘trap’ = modal
This should absolve the need for
receivedFocus
as all overlays need focus for the screen reader to step into them whenaria-*
attributes are not managing the content relations.
interaction:
- likely the only interaction not managed by
tabOrder
islongpress
which really only manages the first click event.
backdrop management:
- not all “modals” have a backdrop and we need to manage it somehow
- it may be that backdrops need to be handled 100% of the time by the overlaid content and not by the overlay system
stack management:
- overlays need access to the stack to prevent DOM based state resolution
- adding/removing something from the stack should be synchronous
- any new non-
tabOrder='none'
content should dismiss all preceedingtabOrder='none'
content on the stack
overlay management:
- (on or off the stack) should manage their own asyncrony
- lifecycle should be both explicit and easy to apply
Does abortPromise
belong on the overlay lifecycle? Does making the stack syncronous prevent needing to maintain this code path.
Configurable and re-configurable overlays:
- elements like
sp-picker
should be able to surface more options around the overlay they throw, see coment and issue - overlays thrown in this way should be “updatable”, for instance when going between mobile and desktop so that the wrapper (Tray vs Popover) and placement (specific vs ‘none’) can be swapped
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
[Feat]: `sp-action-menu` should support customizing the internal `sp ...
When using sp-action-menu , there is no way to customize the internal sp-menu that is opened. Potential use cases could be specifying a...
Read more >Abstract APIs Reviews - Pros & Cons 2022 - Product Hunt
Abstract APIs was rated 3 out of 5 based on 17 reviews from actual users. Find helpful reviews and comments, and compare the...
Read more >dPCR: A Technology Review. - Abstract - Europe PMC
In this review, we compare the fundamental concepts behind the quantification of nucleic acids by dPCR and quantitative real-time PCR (qPCR).
Read more >Plugins - Leaflet - a JavaScript library for interactive maps
A leafletjs plugin that makes it easy to overlay all the different tile layers available from the Azure Maps. Supports using an Azure...
Read more >jyP - River Thames Conditions - Environment Agency - GOV.UK
Doctor review sites, Mark zimmerman moody radio, Free sony ericsson k550i games ... Tragically hip lyrics grace too, Abstract choreography definition, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Re: #2, funny that you ask. We have been looking into an
<sp-modal>
element that works more like a self managed<sp-tooltip>
that might align with that: https://modal--spectrum-web-components.netlify.app/storybook/?path=/story/modal--defaultConsider this when rewriting the API. https://github.com/adobe/spectrum-web-components/issues/1831