Menu
CoddyTech

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 icon

Challenge

Medium

Keep 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>
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Responsive UI Patterns