Over-Easy Anchor + Popover Mini Web Machine
Skills:
Prompt Craft80%Prompt Systems Engineering70%Agent Foundations60%Tool Use & Function Calling60%CV Basics50%
Key Takeaways
The video demonstrates the use of CSS anchor positioning and HTML popover features to create a responsive and accessible overlay experience, leveraging tools such as Anchor API, CSS, HTML, JavaScript, and Popover feature.
Full Transcript
presenting the over easy machine an overlay machine combining CSS anchor positioning and optionally but let's also just be honest highly likely HTML popover feature no longer does the positioned element need to be a child of the thing it wants to attach to and even better javascripts not required for rad Dynamic positioning showing and hiding of the popover and focus management woo let's dig [Music] in you're watching Mini web machines where we dive into small groups of code that drive rad user experiences let's kick this party off with an overview of anchor this API seriously rocks so hard it's easy to get started with but it's packed with features like autof flipping like on top and bottom depending on if it's in the viewport Auto visibility like is the item it's trying to Anchor to even visible right now or not and handy dandy positioning keywords so as shown here the anchor feature is Chrome first making this the first manyi web machines that's not Baseline ready but don't worry though we'll blink an eye and anchor is going to be cross browser so for now if you need to tuck this episode into your utility belt for later use it's time to get a basic example working it takes two to tango with the positioning aspects of the OV easy machine you need an anchor and a positioned element for the anchor it's a oneliner just give the element an anchor name for the positioned element this is where all the magic happens it's also where all the JavaScript worked used to be the element needs to be position fixed or absolute so let's add that next we need to add position anchor to set the anchor element we want to position against you know by default and the first fun part using keywords to specify where the positioned element should be placed and huzzah over and easy no position relative no Cal no noise just responsive adaptive positioning yeah at this point you might be like how many keywords are there well unas got us covered with this great tool anchor tool I like opening it up clicking the position I want choosing logical properties of course and then snagging that code right off that page and pasting it into my position area value and so anchor positioning already so satisfying but let's do some more with this machine here's a mouse Centric popover interaction we're hovering over a user in this system shows a small card of their details the inline links in the paragraph will be the anchors and each of the cards will be positioned elements let's build this up from scratch here's our HTML with unposed elements ready to become positioned popovers with the OV easy machine we're going to start by giving each inline link a unique anchor name second we'll give each of the user cards a position anchor that points to the contextually relevant anchor and next add some CSS to the author meta we're going to add position fixed and position area block start and ah pause here to just admire how easy that was to attach an overlay to an inline element what a breath of fresh air at least in my opinion now it's time to add some popover functionality all right so we'll head to our author meta Dives and we're going to add the attribute popover so it's basically like a oneliner to turn these into a popover but poof where' they go they disappeared well it turns out popovers are like a dialogue they're display none by default they follow a lot of the functionality of a dialog 2 so you're going to find a lot of crossover with the pop and lock machine it's in the top layer I mean pop overs are it can Aid in Focus management and it's already position fixed so we can remove that style but for this demo we're not using the arguably Superior declarative strategy for popovers for showing and hiding them we're going to trigger them on Hover don't worry the next example won't have any JavaScript and will be accessible to Alternative input modes all right it's time for some js we want to show popovers when those inline links are hovered on so we're going to select those links by grabbing all the elements that have the data hover popover attribute we're going to stat the popover for each anchor link in that closure and we're going to set up a mouse enter listener for each link and then show the popover and so check this out popovers already have light dismiss which is kind of a big difference from a dialogue and so we're not going to hook that up to set it up and voila we've used the OV easy machine with popovers to create a very applike experience with just a few lines of CSS and some JavaScript but guess what we can do better let's spice up the functionality with some more anchor position features first up let's remove some cruft position fixed we don't need it it's already the value for a popover next and this is a gotcha that I really want to stress a popover has an inset value by default it's set to zero we must overwrite this if we want our anchor flip feature to work which is what we're going to do next so to remedy this gotcha give anchored popovers the style of inset Auto and just think me later for that hot tip you know or you can pull your hair out when you're wondering why your anchor position features aren't behaving on a popo like you expect you know it's on you okay on to the fun part let's teach the anchor element to flip to the top or bottom of its anchor depending on which will keep it in the viewport this is done with position try fallbacks and we're going to set this value to flip Block in our case we're using block start as the position area so this line of CSS says try and be on block end if the position of block start means I'd be off screen so at first nothing looks like it's changed but what if we had a style to the body tag so that we can scroll this demo then we're going to see and here it is the overlaying element is now intelligently Swit switching from the top or bottom as needed to stay in view with one line of CSS I love it when one line of CSS has so much power okay but there's also there's more there's so much more there's another anchor feature that's just as slick and it's called position Tri order and we're going to pass it the value of most height so not only will the author card flip from top to bottom based on the viewport it now flips based on which quadrant of its containing block has more height this is really cool so sweet okay but for a final touch pop a margin block on the author meta class to add space above and below the overlaying author card and now wasn't this over easy it was it's popping over and it was really easy am I right I don't know I thought it was a good name okay so we got one more example of over easy and pop over combine to show you and this one uses no JavaScript it's accessible to a keyboard you get to learn another in position feature and let's add some show hide transitions to the popover like last time here's my anchor and here's the element I want to position to the Anchor start by giving the positioned element which I've called floaty here the popover attribute and it disappears but you know we wanted that it's now display none and position fixed popovers have a rad declarative API we haven't seen yet for showing and hiding them the popover just needs an ID we can teach our anchor button to show the popover with one line of HTML popover Target equals demo the ID of our popover the default action of this is to show a Target popover and so it's way up here in the corner but that's okay we'll anchor it in a second and while po popovers have light dismiss by default offering a close button can be nice two HTML attributes to do this describe which pop over to Target and then give it in action close all right we'll give it a test and it works rad so now let's anchor this floaty make the icon button an anchor by giving it an anchor name then tell the floaty to default its anchor positions to the Anchor icon never forget popovers need inset Auto if you want to Anchor them now we can give it position area block start and again this is all good okay let's teach it to flip yep that looks great let's teach it about Heights so it's more Dynamic looks good but here's a new one position visibility this will hide the popover if the thing it's anchored goes offc screen and bring it back when it comes back into view hot diggity dang right okay so now it's time to animate this floaty I'll save us some time by pasting in the necessary code but if this looks super forward to you watch the last episode of Mini web machines on the pop and lock dialogue I cover what all these magical incantations mean and do the important bit that's different for popovers is the hook for when it's open notice the use of popover open and also notice I threw in a spring easing from open props just so it looks extra floaty over top that anchor when it animates in and that's it we've got great keyboard support where Focus order is appropriate before and after closing we've added a backdrop and an animation we can still light dismiss we can still use the Escape key ah life is good our OV easy popover machine is hooked up and ready to rock I hope you enjoyed this mini weap machine check the show notes for links to the code and overall y'all get excited for anchor and popover apis they're amazing and one final note the mouse hover example will eventually not need JavaScript either keep your eyes out for the interest Target attribute which is like popover action in that it can show hide popovers declaratively but the interest part of the attribute describes a mouse or keyboard Focus are showing interest in the element so toggle the visibility of a Target popover and watch out for popover equals hint which will hide any other open popovers this combo is meant for Tool tips or other popover UI you want to show declaratively when a mous keyboard is showing interest in an element which is exactly what we did but we had to add some JavaScript and when we added that JavaScript we kind of lost some of that great Focus management so be on the lookout for these rad new attributes amazing stuff thanks for watching like And subscribe and watch out for the next Mini web machine d [Music]
Original Description
With CSS anchor(), overlaying and connecting UI elements has never been easier. The Over-Easy Machine shows how a few lines of CSS can make position relative and top/left a thing of the past. Combine the Over-Easy machine with Popovers for a truly remarkable and accessible overlay experience. By the end, you'll know the basics of anchor() and how to show, hide, and transition Popovers.
Chapters:
0:00 - Introduction
0:32 - anchor() overview
1:11 - Over-Easy Machine
2:12 - Over-Easy Hover Popover
6:18 - Over-Easy Toggle Tip Popover
8:55 - Future of Popover
9:47 - Outro
Resources:
Anchor
Introducing the CSS anchor positioning API → https://goo.gle/3SWrvM5
MDN anchor() → https://goo.gle/3TjacoL
Una's anchor tool → https://goo.gle/3yDYDSd
Popover
Popover API lands in Baseline → https://goo.gle/3Vo2dIs
MDN popover → https://mzl.la/4dMWiUd
Demos
Over-Easy → https://goo.gle/4erTlbJ
Over-Easy Hover Popover → https://goo.gle/4e9AuSl
Over-Easy Toggle Tip → https://goo.gle/3Xaqd1w
Caniuse
anchor() → https://goo.gle/3Z9rsjW
position-visibility → https://goo.gle/3ZaBelX
position-try-order → https://goo.gle/3z4McyM
position-try-fallbacks → https://goo.gle/3AYl1Gm
Watch more Mini Web Machines → https://goo.gle/MiniWebMachines
Subscribe to Chrome for Developers → https://goo.gle/ChromeDevs
#ChromeForDevelopers #Chrome
Speaker: Adam Argyle
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Chrome for Developers · Chrome for Developers · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Polymer Performance Patterns (The Polymer Summit 2015)
Chrome for Developers
Polymer Power Tools (The Polymer Summit 2015)
Chrome for Developers
Chrome Dev Summit 2014 – Chrome Case Studies
Chrome for Developers
Web Directions Code 2015 round up
Chrome for Developers
Maintainable Code - HTTP203
Chrome for Developers
iron-ajax… wat?! -- Polycasts #26
Chrome for Developers
The Guardian - Supercharged
Chrome for Developers
ES2015 (next version of JavaScript), Totally Tooling Tips (S2 Ep1)
Chrome for Developers
#AskPolymer: Rob answers all the questions ever -- Polycasts #27
Chrome for Developers
The Future of JavaScript - HTTP203
Chrome for Developers
Data Binding 101 -- Polycasts #28
Chrome for Developers
The Guardian part 2 - Supercharged
Chrome for Developers
The Future of Web Audio: with Chris Wilson and Chris Lowis
Chrome for Developers
Chrome 46: New motion-path animations, client hints and service worker improvements
Chrome for Developers
Sublime Snippets, Totally Tooling Tips (S2 Ep2)
Chrome for Developers
#AskPolymer: How do you make the show? -- Polycasts #29
Chrome for Developers
Critical Path CSS, Totally Tooling Tips (S2 Mini Tip #1)
Chrome for Developers
Binding to Objects -- Polycasts #30
Chrome for Developers
Player FM - Supercharged
Chrome for Developers
Where’s the Designer? #AskPolymer -- Polycasts #31
Chrome for Developers
Jake Beats Wikipedia - HTTP203
Chrome for Developers
Supercharged Observers! -- Polycasts #32
Chrome for Developers
Jai's Web blog - Supercharged
Chrome for Developers
Windows Command-line Tooling, Totally Tooling Tips (S2, Ep4)
Chrome for Developers
What about internationalization? #AskPolymer -- Polycasts #33
Chrome for Developers
Developing for Billions (Chrome Dev Summit 2015)
Chrome for Developers
Google+ Performance Improvement Comparison
Chrome for Developers
Deploying HTTPS: The Green Lock and Beyond (Chrome Dev Summit 2015)
Chrome for Developers
Progressive Web Apps (Chrome Dev Summit 2015)
Chrome for Developers
Instant Loading with Service Workers (Chrome Dev Summit 2015)
Chrome for Developers
Increase Engagement with Web Push Notifications (Chrome Dev Summit 2015)
Chrome for Developers
Engaging with the Real World: Web Bluetooth and Physical Web (Chrome Dev Summit 2015)
Chrome for Developers
Asking for Permission: respectful, opinionated UI (Chrome Dev Summit 2015)
Chrome for Developers
Polymer - State of the Union (Chrome Dev Summit 2015)
Chrome for Developers
Building Progressive Web Apps with Polymer (Chrome Dev Summit 2015)
Chrome for Developers
Introduction to RAIL (Chrome Dev Summit 2015)
Chrome for Developers
DevTools in 2015: Authoring to the max (Chrome Dev Summit 2015)
Chrome for Developers
RAIL in the real world (Chrome Dev Summit 2015)
Chrome for Developers
#ChromeDevSummit talks are up - W00T! -- Polycast #34
Chrome for Developers
V8 Performance from the Driver's Seat (Chrome Dev Summit 2015)
Chrome for Developers
Quantify and improve real-world RAIL (Chrome Dev Summit 2015)
Chrome for Developers
Owning your performance: RAIL (Chrome Dev Summit 2015)
Chrome for Developers
HTTP/2 101 (Chrome Dev Summit 2015)
Chrome for Developers
Leadership Panel (Chrome Dev Summit 2015)
Chrome for Developers
Build Processes, Totally Tooling Tips (S2, Ep 5)
Chrome for Developers
Accessibility (Chrome Dev Summit 2015)
Chrome for Developers
Binding to Arrays -- Polycasts #35
Chrome for Developers
HTTP2 - HTTP203
Chrome for Developers
Chrome 47: Splash Screens, requestIdleCallback and better desktop notifications (New in Chrome)
Chrome for Developers
Call For Submissions - Supercharged
Chrome for Developers
Cross Device Testing, Totally Tooling Tips (S2 Ep6)
Chrome for Developers
Testing AJAX with Web Component Tester -- Polycasts #37
Chrome for Developers
Slack: Extended Xmas Special - Supercharged
Chrome for Developers
Browser testing with Travis & Sauce Labs -- Polycasts #38
Chrome for Developers
Optimize for production with Vulcanize -- Polycasts #39
Chrome for Developers
Highlights from Chrome Dev Summit 2015
Chrome for Developers
Chrome 48: Custom buttons in notifications, DevTools Security panel, and Presentation mode
Chrome for Developers
Crisper: Protecting your Polymer app with CSP -- Polycasts #40
Chrome for Developers
How do I use Sass with Polymer? #AskPolymer -- Polycasts #41
Chrome for Developers
Colors – DevTools Tonight #0 (Pilot)
Chrome for Developers
More on: Prompt Craft
View skill →Related Reads
📰
📰
📰
📰
Swift typealias — What It Is, What It Does, and Why It Matters
Medium · Programming
s3fifo 1.0: Zero-Allocation S3-FIFO Cache for Node.js is Ready for Production
Dev.to · JeongSeop Byeon
Node.js Error Handling Patterns for Production Queue Systems
Dev.to · Faisal Nadeem
Make Your CLI Config Write Survive Ctrl-C Without Leaving Truncated JSON
Dev.to · Sam Rivera
Chapters (7)
Introduction
0:32
anchor() overview
1:11
Over-Easy Machine
2:12
Over-Easy Hover Popover
6:18
Over-Easy Toggle Tip Popover
8:55
Future of Popover
9:47
Outro
🎓
Tutor Explanation
DeepCamp AI