Auro Layover Component - HTML5 Popover Implementation #594
jason-capsule42
started this conversation in
Technical Research Documents
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Introduction
The Layover component is intended to be a single point of entry for all implementations of the native HTML5 popover spec. It should contain multiple behaviors such as dialog, tooltip, dropdown, and more that allow a consumer to quickly and easier create elements that use the HTML5 native popover spec and behave in those ways.
It serves to:
It should:
HTML5 Popover Spec
https://developer.mozilla.org/en-US/docs/Web/API/Popover_API/Using
Utilities and Components To Support This Solution
auro-layover
Supporting Code from auro-library
Technical Details
auro-library
Focus Trapping
Enables trapping the focus within a specified element when the user shifts focus using the tab key
Popover Positioner (controller)
Exposes controls and methods for implementing Floating UI.
StringBoolean
Allows for string boolean values to be attached to attributes, e.g.:
auro-layover
Triggers
Popover
typeattribute.auto- browser default behaviors (events associated with the below) (CAVEAT only works with button triggers - HTML5 element with type="button")manual- have to write your own event handlers for open/closehint- e.g. tooltip that shows on hover/focusArrow
arrowarrowPositionRender
:backdropfor popovers when they are projected to the top of the document.Behaviors
Each behavior has a default configuration.
Dialog
Dropdown
Input
Tooltip
Configuration can be customized per behavior.
useHide- auto-hide when trigger not in viewportuseFlip- currently our noFlip attribute but reverseduseShift- nudge the popover to fit in viewportinline- only enable this on auro components that might use inline elements in the trigger slotuseAutoPlacementplacement- default placementoffset- distance between trigger and popoverallowBodyScroll- false by defaultdisabled- only controlled by the component directly implementing the layover (dropdown, dialog, drawer, popover)* Full Screen Handling
Events
auro-layover-shownauro-layover-hiddenauro-layover-changeauro-layover-beforechangeA11Y
What Problems Were Discovered and Addressed During Development
Current Patch Caveat
Non-Dialog Usage with Popover
When the user can interact with the page when a popover is visible, such as with a dropdown, if there are multiple such elements on the page, clicking on a second one causes a poor UX:
Our solution resolves this issue
Visible Encapsulation of Dropdowns in Dialogs
“Passive Focus” Solution
The current implementation automatically shifts focus to the first element in the popover, which can lead to unexpected UI states and suboptimal user experience.
The proposed solution introduces a "Passive Focus" mechanism that mimics the browser’s native popover focus behavior while enhancing it with a focus trap to maintain accessibility and control.
Example Use Case w/ Current Implementation:
Example Use Case w/ New Implementation
Refactoring for Maintainability and Clarity
The current implementation has grown organically and combines several concerns in a single component (AuroFloatingUI), making it harder to extend or maintain.
The updated approach aims to improve modularity and maintainability by applying SOLID principles more explicitly.
Open Questions
How does the screen reader handle nested popovers and what is
inertand what is not?Does it still need to be in auro-dialog?
Does it still need to be in auro-drawer?
A11y
Future Work
Is there any good reason to keep this in layover rather than abstract it?
What type of code best suits our current and future needs?
Beta Was this translation helpful? Give feedback.
All reactions