Popover API & discrete property transitions
In order for all of this to transition popovers in and out smoothly, the web needs some way to animate discrete properties.
These are properties that typically weren’t animatable in the past, such animating to and from the top-layer and animating to and from display: none
.
As a part of the work to enable nice transitions for popovers, selectmenus, and even existing elements like dialogs or custom components, browsers are enabling new plumbing to support these animations.
※ Sorry! Current browser doesn't support Popover API. There will be no action when you tap the above button.
※ Sorry! Current browser doesn't support discrete property transitions. There will be no smooth transition effect when popover in or out.
Basic Usage
Use popover
& popovertarget
attribute to elements to let them have connection for each other.
Attribute popover
has two value for differebt purpose.
- auto
(default): can be "light dismissed" by selecting outside the popover area. esc can dismissed popover element too.
- manual
: must always be explicitly hidden, but allow for use cases such as nested popovers in menus.
Style Customization
The following popover demo, animates popovers in and out using :popover-open
for the open state, @starting-style
for the before-open state, and applies a transform value to the element directly for the after-open-is-closed state. To make this all work with display, it needs adding to the transition property, like so:
Reference
Dialog Title
A dialog is a type of modal window that appears in front of app content to provide critical information, or prompt for a decision to be made.