A useful interface does not need to be complicated. Start with native HTML, then add JavaScript only when you need it.
What You Need to Know
Progressive enhancement means beginning with a usable plain page, then adding newer browser features when available. Visitors should still complete the main task if an advanced widget is missing.
Try the Example
Take a look at the example. We’ll explain the important lines right below it.
<details>
<summary>Shipping information</summary>
<p>Standard delivery takes three to five business days.</p>
</details>
<p>The disclosure still works if JavaScript is disabled.</p>
Let’s Read the Code
- <details>: Details makes a section expandable without requiring a custom script.
- <summary>: Summary is the label people activate to expand or collapse details.
What the example shows: Progressive enhancement starts with a feature that already works using ordinary browser behavior.
What Happens in the Browser?
When this example includes JavaScript, it supplies behavior that ordinary HTML does not automatically provide. Always think about a fallback.
Start with native behavior. Details, dialog, and popover each solve a different interface problem. Choose the simplest control that actually matches what a visitor wants to do, then test focus and dismissal as well as appearance.
Your Turn
Disable scripts and open the details element using the keyboard.
Common Beginner Mistakes
- Assuming new HTML syntax works in every browser without testing.
- A custom widget must not accidentally make basic content unavailable when JavaScript fails.
Key Takeaways
- Progressive enhancement means beginning with a usable plain page, then adding newer browser features when available.
- <details>: Details makes a section expandable without requiring a custom script.
- Test the behavior you expect rather than trusting how the snippet looks in your editor.