Many interface patterns that once needed a JavaScript library are now built into HTML itself. Pop-up windows, small overlays and expandable sections can be created with a few native elements and attributes, and the browser takes care of focus, keyboard support and accessibility for you. Using them means less code to write, less to maintain, and fewer things that can break.
This module starts with the dialog element for building modal windows. It then covers the popover attribute, which turns any element into an overlay that opens from a button. Next you'll learn details and summary for content that expands and collapses, and how to group them into a native accordion where only one section is open at a time.
Watch the lessons in order, then continue on to Performance & Best Practices.
Shows how the dialog element lets you display a modal box without installing an extra JavaScript library.
Covers the popover attribute, the popovertarget attribute on a button, and the auto and manual popover types.
Introduces details and summary for building an accordion-style interface without custom JavaScript, CSS and HTML.
Builds a native accordion where one item opens at a time, then styles it with CSS, all without JavaScript.