Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Popover component #5271

Open
27 tasks
rolfsmeds opened this issue Apr 25, 2024 · 3 comments
Open
27 tasks

Popover component #5271

rolfsmeds opened this issue Apr 25, 2024 · 3 comments
Labels
acceptance criteria used for the acceptance criteria checklist DS Design System feature (e.g. component) V24.5

Comments

@rolfsmeds
Copy link
Collaborator

rolfsmeds commented Apr 25, 2024

Description

A generic component for creating popovers positioned to an anchor element.
(Different from tooltips in that popovers can contain interactive elements like buttons and input fields.)

Use cases

  • Custom dropdown fields (especially non-list-based ones)
  • Popups opened from buttons (where the content is suitable for MenuBar)
  • Interactive toggletips

Acceptance criteria

  • Web Component vaadin-popover, Flow component Popover, React component <Popover>

Positioning

  • API for designating another UI element as the anchor to which the popover is positioned (cf. Tooltip)
  • API for specifying how the popover is positioned relative to the anchor element (cf. Tooltip)
  • Popover follows the anchor when it moves within the viewport
  • API for whether the popover should overlap the anchor (i.e. render on top of it, as opposed to outside its boundaries)
  • API (could be just 4 custom css properties) for setting the offset between anchor and overlay (top, bottom, start, end)

Modality and focus

  • API for toggling modal/non-modal (default should be non-modal)
  • API for toggling modality curtain when modal
  • Focus trap when modal
  • API for setting automatically focusing the popover when opened

Open/close behavior

  • API for setting how it opens: on anchor click (default?), on anchor hover, manual
  • API for setting how it closes: on outside click and Esc (default?), on mouseout/Esc, manual
  • Configurable hover and hide delays

Accessibility

  • ARIA: role="dialog", APIs for setting aria-label and aria-labelledby
  • Restores focus to previous element when closed

Styling

  • Optional "wedge" pointing at anchor (maybe as theme variant?)
  • Lumo styling: background --lumo-base-color, --lumo-box-shadow-m.

Miscellaneous

  • API for setting popover dimensions
  • API for setting popover classname

Possible later enhancements:

  • Optional static header and footer, with scrollable content are in between (like Dialog)
  • Optional title in header (like Dialog)
  • (Feel free to propose more in comments)

General criteria

  • APIs reviewed
  • Design
  • Performance
  • UX/DX tests in Alpha
  • Documentation:
  • How to test?
  • Limitations:

Security

  • Security implications have been taken into account (elaborate or link to product security requirement specification if there are implications)
@knoobie
Copy link
Contributor

knoobie commented May 24, 2024

Possible later enhancements:

Allow lazy loading of popover content. The popover content on the server side should only instantiiate once the popover is opened; not on the initial page load.

This might need some styling within the popover? Like a spinner / loading indicator so that the popover opens with e.g. 10x10rem and a spinner until the content was fetched so that the user gets instant feedback even for slower server inquiries. (Or: add a loading property the user can use for styling)

@jouni
Copy link
Member

jouni commented Jun 4, 2024

Lumo styling: background --lumo-base-color, --lumo-box-shadow-m

Minor addition: box-shadow should include a 1px outline in addition to box-shadow-m, like other overlays, but that should like already come from here: https://github.com/vaadin/web-components/blob/main/packages/vaadin-lumo-styles/mixins/overlay.js#L27

@jouni
Copy link
Member

jouni commented Jun 4, 2024

This is clearly only a potential future refactoring option, but just want to remind that the CSS anchor positioning API is what we should eventually use. It’s available in Chrome today. Similarly as the popover attribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acceptance criteria used for the acceptance criteria checklist DS Design System feature (e.g. component) V24.5
Projects
Status: Summer 2024 (24.5)
Development

No branches or pull requests

4 participants