question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feat]: Abstract Overlay API Review

See original GitHub issue

Code 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 when aria-* attributes are not managing the content relations.

interaction:

  • likely the only interaction not managed by tabOrder is longpress 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 preceeding tabOrder='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:open
  • Created 2 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
Westbrookcommented, May 24, 2022

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--default

0reactions
najikahalsemacommented, Oct 26, 2022
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found