Nonblocking Decoration
Part of the Responsive UI Patterns section of Coddy's Tailwind CSS journey. Lesson 43 of 55.
A decorative overlay can accidentally block an otherwise usable button. pointer-events-none lets pointer hit testing pass through that layer to content behind it while leaving the layer visible. Put the utility on the decoration, not on the actual control.
<div class="relative"><a href="#details">Details</a><div aria-hidden="true" class="absolute inset-0 pointer-events-none border"></div></div>The example keeps a decorative frame above a link. aria-hidden="true" separately removes the frame from accessible content; ARIA hiding does not affect pointer interception. Preserve both policies for a purely visual overlay.
Verify the actual action, not only the appearance. A frame can look correct and still intercept every click. Supplied handlers in this lesson expose a visible counter so the pass-through behavior can be tested without writing JavaScript.
Challenge
MediumKeep the visible decorative overlay above the reservation button, but make it ignore pointer events so clicks reach the native button. Preserve aria-hidden on the decoration. The supplied reservation counter must advance on each button click.
Preserve the supplied content, semantic elements and IDs. Edit the requested utility classes. Press Run preview after edits, then Check/Run code to grade the result. Supplied JavaScript is read-only.
Try it yourself
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Interface workshop</title><link rel="stylesheet" href="./styles.css"></head><body>
<div class="relative w-64 h-24"><button id="action" class="absolute inset-0">Reserve place</button><div id="overlay" aria-hidden="true" class="absolute inset-0 border-4 border-blue-500 pointer-events-auto"></div></div><output id="count">0</output>
<script src="./controls.js"></script>
</body></html>
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Responsive UI Patterns
1Page Shells
Growing Page ShellsFlexible Content RailsBounded Scroll RegionsFull-Bleed RegionsRecap: Page Shells4Form Layouts
Responsive Field GroupsFocused Field GroupsSelectable Form OptionsNative Validation CuesRecap: Form Layouts2Navigation Patterns
Wrapping NavigationCurrent Page CuesNative Menu DisclosuresKeyboard Skip LinksRecap: Navigation5Data Tables
Scrollable Data TablesPredictable Table ColumnsRow State PresentationSticky Table HeadersRecap: Data Tables8Interactive Panels
Expanded Control CuesChoice Card StatesFocus-Aware Help PanelsContent-Aware Empty StatesRecap: Interactive Panels11Project: Event Portal
Portal ShellSession Browser3Content Cards
Aligned Card ActionsCard Media FramesResponsive Feature CardsShared Card RowsRecap: Content Cards6Container Queries
Component Width QueriesBounded Component StatesNamed Query RegionsBounded Fluid ComponentsRecap: Container Queries9Layered Surfaces
Anchored Card BadgesLocal Layer BoundariesNonblocking DecorationResponsive Sticky RailsRecap: Layered Surfaces