Перейти к содержимому

How to use popover API

Coding in Public

0:00 / 0:00

How to use popover API

1 094 просмотра · 2 месяца назад
Coding in Public
57,3 тыс. подписчиков
1 094 просмотра · 2 месяца назад
Stop reaching for JavaScript every time you need a popover. In this video, I'll show you how to build accessible, animated popovers using just HTML and CSS, including a bunch of brand new CSS features you need to know about. The basics of the `popover` attribute, `popovertarget`, and `popovertargetaction` for wiring up buttons Built-in accessibility wins: focus management, escape key handling, and the top layer Styling popovers with `position-area` and `margin-block-start` to anchor them to a button Transitioning between `display: none` and `display: block` using `transition-behavior: allow-discrete` Using the `:popover-open` pseudo-class, the `overlay` property, and `@starting-style` to animate entrances and exits independently 🔗 Key Links 🔗 https://github.com/coding-in-public/p... --------------------------------------- ⏲️ Timestamps ⏲️ 0:00 Intro 0:15 Popover Basics 0:35 Making It Functional 2:23 Default Popover Styles 3:45 Customizing styles 4:21 Positioning With Position-Area 5:46 Advanced styling --------------------------------------- 🌐 Connect With Me 🌐 Astro course: https://learnastro.dev Website: https://codinginpublic.dev Blog: https://chrispennington.blog 🤝 Follow Me 🤝 Twitter:   / cpenned   BlueSky: https://bsky.app/profile/codinginpubl... 💸 Support Me 💸 Patreon:   / coding_in_public   Buy Me a Coffee: https://www.buymeacoffee.com/chrispen...