The Looper Mini Web Machine
Key Takeaways
The Looper Mini Web Machine, a radio group, is showcased for building user experiences with automatically unselecting previous items and supporting mouse, keyboard, screen readers. It's a perfect Mini web machine for less than eight items, with features like roving UX, cyclical focus, and accessibility.
Full Transcript
presenting the Looper a Powerhouse machine for building all sorts of awesome stuff like this and this F this it might not look like much unstyled but it packs a punch of functionality that's Mega [Music] useful the Looper features automatically unselecting the previous item ensuring that only one can be selected at a time and I call it unconcealed because all the options are shown to the user without an action to reveal the full set you know like a select element where you have to click it to see all the options as opposed to this radio Group which just lays them all out there for you it's also super accessible it supports mouse keyboard screen readers and has been a solid little machine for many years it's a perfect Mini web machine to use when there's like less than eight items or so to pick from but if there's more than that there's certainly use cases where you might want to reach for a select or something that does conceal the additional options you know to prevent Choice overload managing State it's super fun and stuff but it's also really fun when the browser manages the state for you and so in the case of this the browser manages the selection State and also offers a few ways to style or access the data from it from CSS we have the checked pseudo class and from JavaScript we can query the checked pseudo class like via query selector or you can use Looper inside of a form and access the selected value from the form data API lots of choices classic web now if it wasn't obvious or maybe you're wondering why I called it at the Looper it's because this supports something called roving Focus or roving index that's like a fancy term for saying it's a meaningful Focus trap that is cyclical upon interaction that cyclical aspect is why I called it the Looper but roving ux has even more features check this out if I had to tab through a 100 videos in that first section just to get to the second section that would be absolutely terrible well the way a radio group works and the way that roving ux works is you focus into that area and then you can move with the arrow keys and if you hit tab again you jump to the next section so you're not trapped inside of there you're actually you go in you dip around with the arrow keys and then you can jump out and go to somewhere else that's very critical in the interaction pattern something to note when you go and copy and paste this machine which I hope you do I am using the implicit label input relation here this is where the input element is inside of the label this means I don't have to use the four attribute or give the input an ID but there's certainly use cases where your label might be somewhere else and your input is somewhere else at which point you can connect them together and by the way always use a label you can connect them together by giving the input an ID and the label element a four attribute that points to that ID now when you click the label it selects that particular radio it's a really cool way to kind of separate your concerns and also build really engaging experiences and a little bonus tip the field set element which you might remember from gooey challenges hopefully you saw some of those episodes it can make observing value changes super easy so normally you might look at each particular input and wait for them to change and then try to manage state that way ah it's really messy or you can use a field set element put all these inside of it and watch for changes on the field set element kind of rolling up all the changes of the inputs into one single place for you to observe and I really like that pattern plus then you get to use the legend element and then you get to be a legend or use a legend I don't know anyway it's the legend element who doesn't want to use that one it just sounds rad so earlier in this episode I teased to some really cool use cases of the Looper and now let's go into those a little bit deeper and try to look like a pro this one is kind of silly it's very literal so here I tab into the radio group and then where's the start and where's the end I don't know cuz someone put this layout of this radio group into a circle and now it goes around forever I can use the up Arrow the down arrow the left Arrow the right arrow and it's just kind of silly it was also a fun use of trigonomic CSS you know make a circle layout that's fun this one you can see the label and the input so there's a pretty strong hint right there that this is backed by the Looper and of course if I tab in I get cyclical uh interaction here so I can kind of loop through these forever and thanks to the view transitions API I can morph between the selection so basically this is a grid layout the current one that's selected the one that's checked remember we saw that CSS hook it's the larger one in the layout but if the checked State changes a different one has become the larger one and I just say hey grid make this one big and hey view transitions I'm going from an old state to a new state would you please morph those elements between the states and it does it all and the final inspirational demo for what you can do with the Looper is this single selection plant Chooser and it does this by well here let's see I'm in a radio group look there's only one checked at a time and if I get to the end and I go back to the beginning there is your strong clue we are trapped inside of some roving ux it's freely delivered by a radio group and the way that this one works is it takes that checked pseudo class that CSS we were talking about earlier and it promotes it by giving it grid template columns it's going to have more FR units assigned to it than the ones next to it so the one in the middle here is getting about five the one on each side is getting about two and a half and the ones at the end are getting one and then as I move through I use the has selector to look at which one is selected and I select the adjacent ones next to it as well as the one here and give them a different size in Fr units and then you can transition grid template columns so you combine transition and grid template columns the Looper element and the easing function for getting springy animations and you've got yourself this super cool rad demo if you liked this episode go ahead and tell us in the comments I'm curious should I keep making more Mini web machines I've got a long list of things that I think make really good little reusable machines but I need to hear from you to let me know so give a like give a subscribe give me a comment and I hope I can send you some more Mini web machines see you later y'all [Music]
Original Description
Introducing Mini Web Machines, where we dive into small groups of code that drive rad user experiences. This debut episode showcases The Looper, aka a radio group.
Copy the code → https://goo.gle/3TTzLMv
Resources:
The Looper roving UX → https://goo.gle/3VLjaNI
Cyclical radio group → https://goo.gle/3Jcqjz3
Radiento bento group → https://goo.gle/43ToWPl
Bouncy plant picker → https://goo.gle/3xxutPt
Chapters:
0:00 - Introduction
1:27 - The Looper
3:30 - Use cases
5:37 - Wrap up
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: HTML & CSS
View skill →Related Reads
📰
📰
📰
📰
11 Lessons I Learned After 4 Years as a Content Writer
Medium · Data Science
Why I Stopped Using Copy.ai After Three Months (And What I Switched To Instead)
Medium · AI
The Draft That Sounds Perfect Is Usually the One to Throw Away
Medium · AI
The Draft That Sounds Perfect Is Usually the One to Throw Away
Medium · ChatGPT
Chapters (4)
Introduction
1:27
The Looper
3:30
Use cases
5:37
Wrap up
🎓
Tutor Explanation
DeepCamp AI