Where your click really lands

By the end you will see how the browser picks the element under your pointer, why pointer-events: none seems to fail, and how to find whatever is stealing your clicks.

GuideInput
01

One point, one winner

pointer-events: none takes an element out of hit testing, the step where the browser decides which element is under the pointer. When it seems not to work, something else is usually winning: a child that sets auto again, a different element on top, or an iframe. Or the input came from a keyboard, which never hit-tests.

For a pointer event, the browser looks at what is painted at that point, from front to back, and picks the first element that accepts pointer events. That element is the event's target. Your script can ask the same question with document.elementFromPoint(x, y). document.elementsFromPoint(x, y) returns the whole stack.

Point at the stack Interactive
Card
Overlay
Sale
Overlay: pointer-events none
Badge: pointer-events none
elementFromPoint → move over the stageThe stack appears here, front to back.

Mouse: move over the stage. Touch: tap, or drag sideways. A vertical swipe scrolls the page. Keyboard: focus the stage and use the arrow keys.

Put the probe where the overlay covers Buy now. A click there goes to the overlay, and the button never hears it. Turn on the overlay switch and the overlay drops out of the list. The button is now first. The layout did not change. Only the answer to "what is here" did.

The numbered lines are what your browser returns. Elements set to none are left out, so the demo checks their rectangles itself and adds a "skipped" line. The probe ring is set to none too. Otherwise it would sit on top and the inspector would report its own ring.

</> Ask the browser what is under a point.Show code
document.addEventListener('pointermove', e => {
  const top = document.elementFromPoint(e.clientX, e.clientY);
  const stack = document.elementsFromPoint(e.clientX, e.clientY);
  // top: the element hit testing picks here
  // stack: everything hit-testable here, front to back
});

One level deeper. Hit testing follows paint order, not just source order. Positioned elements usually paint above non-positioned siblings, and z-index reorders elements within a stacking context. Looking invisible is not enough to escape: opacity: 0 and transparent backgrounds are still hit. visibility: hidden, display: none and the inert attribute take content out. Pointer capture skips the search: after setPointerCapture, which Sliders that fight back uses to keep hold of a drag, that pointer's later events go to the capturing element until release.

02

Inherited, then switched back on

pointer-events is inherited. Set none on a wrapper and every descendant computes none too, unless another rule gives it a value. auto on a child puts that child back into hit testing, even inside a parent that is out.

A toolbar and its buttons Interactive
autoautoauto
Toolbar: pointer-events none
Help: pointer-events auto
toolbar: auto

Turn on the toolbar switch. All three buttons compute none, and a press on any of them lands behind the toolbar. Then turn on the Help switch. Help is clickable again while the toolbar stays out of reach. Each value comes from getComputedStyle after your change.

This is a classic "pointer-events none not working" case. A wrapper is set to none, and a tooltip, close button or toast inside it brings auto from its own stylesheet. Search your CSS and your component libraries for pointer-events: auto.

</> The pass-through layer, on purpose.Show code
/* The layer lets presses through to the page... */
.overlay { pointer-events: none; }

/* ...except on the one thing in it you can click. */
.overlay .close { pointer-events: auto; }

With the toolbar at none, Tab to Bold and press Enter. Its click handler still runs. Section 4 explains why.

03

The parent still hears the click

Hit testing only chooses the target. Then the browser builds the event path from the tree: window, document, every ancestor, then the target. Listeners on that path can hear the event, including listeners on a parent set to pointer-events: none.

Who hears the click Interactive
Article card. A click on the card opens it.
Card: pointer-events none
Guard: ignore clicks from buttons
Press Like, then press the empty part of the card. Keyboard: Tab to Like and press Enter.

Press Like. The log lists the card's capture listener, then the button, then the card again as the event bubbles up. The card opens. It cannot be the target, but it is still an ancestor of the target. Now press the empty part of the card. The target is the well behind it, so the card is not on the path.

One level deeper. The DOM standard builds the path by walking up from the target through its parents, and through shadow hosts where there are any. pointer-events only takes part in the step before that. So none on a parent means "the parent is not the target", not "the parent ignores events". Tab to Like and press Enter. The keyboard click skips hit testing and takes the same path.

Turn on the guard. The card now checks event.target and ignores clicks from a button. That is usually better than stopPropagation() in the child, which also hides the click from everything above the card, such as a menu that closes on outside clicks. The card's pulse is skipped when you ask for reduced motion.

</> Let the parent ignore clicks from its controls.Show code
card.addEventListener('click', event => {
  // Clicks on inner controls bubble up here too.
  if (event.target.closest('button, a, input')) return;
  openCard();
});
04

The keyboard never hit-tests

Hit testing exists for points on the screen. Tab, Enter and element.click() do not ask what is under a point, so pointer-events cannot stop them. A link "disabled" with pointer-events: none is still in the Tab order and still activates on Enter. The property also does not tell a screen reader that the link is unavailable.

Try to use a disabled link Interactive
pointer-events: noneAll modes so far

Press the link with a mouse or a finger. Then press Start here, press Tab, and press Enter. In Safari, you may need Option+Tab, or the "Press Tab to highlight each item" setting, to reach links.

With pointer-events: none, a press lands behind the link, but Tab reaches it and Enter clicks it. A <button disabled> gets no click from your press, and Tab skips it. inert also stops clicks and focus, works on links, and hides the content from assistive technology. One difference: the disabled button still wins the hit test. The inert link drops out of it.

The last mode keeps the link focusable and blocks it in script. Use it when people should still find the control and hear that it is unavailable.

In disabled mode, read the two Events rows. They record which of five events reached the button, and which went elsewhere in the panel, in your browser. We have not measured this in any browser ourselves, so we make no claim about what yours will show. Do not assume disabled silences a pointerdown handler. Test it on your devices.

In the first mode, hover the link. Its cursor: not-allowed does not appear, because the cursor comes from the element that wins the hit test. Put that cursor on a wrapper that stays hit-testable.

</> A link that is off but still discoverable.Show code
<a href="/report.pdf" aria-disabled="true">Download report</a>

link.addEventListener('click', event => {
  if (link.getAttribute('aria-disabled') === 'true') {
    event.preventDefault(); // blocks following the link
  }
});

disabled does nothing on <a>. It works on form controls such as button, input, select, textarea and fieldset, on option and optgroup, and on form-associated custom elements. <link> has its own disabled attribute for stylesheets, which is unrelated.

05

Something else is on top

When your element computes auto and a press still misses it, check what is winning the hit test. The demo breaks one Save button or its list in five ways. Pick a bug, then press Save or scroll the list. Turn on Show the layers when you want the answer.

Find what blocks Save Interactive
Invoice #2041
Design review · $420
Hosting, March · $36
Font license · $90
Icon set · $48
Support hours · $300
Domain renewal · $14
Accessibility audit · $250
Hosting, April · $36
Saved
Show the layers
Pick a bug, then try to press Save or scroll the list.

Child override is section 2 in disguise: a toast opts back in, and opacity: 0 keeps it hit-testable. Layer on top is a later, positioned footer bar with nothing visible over Save. Pseudo-element is harder to spot. These hit-test methods do not return a ::before or ::after box. You get its owner, so the header is reported far below its own text.

Iframe holds a separate document. A press inside it is delivered there, so your page gets no pointerdown and no click. If focus moves into the frame, the readout reports that clue. pointer-events: none on the iframe element lets presses reach your page, but then you cannot click anything inside the frame.

Scroll area shows that wheel and touch scrolling depend on hit testing too. The list inherits none, so your gesture goes to what is underneath. Scroll over the list. When movement stops, the readout shows the change in the page's scrollY and the list's scrollTop. If the page has room to move that way, you can watch it take the scroll. Tab into the list, and the arrow keys still scroll it.

</> The four CSS fixes the demo applies.Show code
/* A hidden toast: invisible and out of hit testing */
.toast:not(.is-shown) { visibility: hidden; }

/* A full-width bar: let presses through, keep its links */
.footer-bar { pointer-events: none; }
.footer-bar a { pointer-events: auto; }

/* A decorative pseudo-element */
.header::after { pointer-events: none; }

/* A scroll area inside a pass-through wrapper */
.wrapper .list { pointer-events: auto; }
06

Find the thief on your own page

One press can point to the cause. Arm the finder, then press something on this page. It reads the stack at pointerdown and swallows only the click that follows. Other pointer events and focus changes still happen. For a first test, choose Layer on top above and press Save. Then try the inert sample.

Inspect one press, take the finder Interactive
Arm the finder, then press anything on this page. Escape cancels.
Hide the blocker instead
Your fix appears here. The finder for your site and the agent prompt are available before you press anything.

Use I meant if the finder guessed the wrong element. Before suggesting that you switch off or hide a layer, it checks for another control above yours. A span or icon inside a button counts as that button. In that case, it says to move or resize one of the two. A cover that holds controls gets a rule that keeps them clickable. The hide version warns that it hides them too.

Copy the finder for your site gives you a script built from this panel's diagnosis functions. Paste it into your page's console and press the dead control once. It logs the stack, a best guess at what you meant, the likely cause and a proposed fix for your elements. Other guesses sit in collapsed groups. Selectors prefer a unique ID or class, then fall back to tag positions.

Treat every fix as a proposal. The finder checks native controls, common ARIA roles, tabindex, onclick attributes and custom elements. It cannot tell that a plain div got a click listener from script. It also does not inspect shadow roots or frame contents. After a fix, run it again, because another layer may be underneath.

</> The core check: is another control in the way?Show code
const controls = 'a[href], button, input, select, textarea, ' +
  'summary, label, [role="button"], [tabindex]';

function controlInTheWay(el, x, y) {
  const stack = document.elementsFromPoint(x, y);
  const above = stack.slice(0, Math.max(0, stack.indexOf(el)));
  for (const hit of above) {
    if (el.contains(hit)) continue;
    const control = hit.closest(controls);
    if (control && !control.contains(el)) return control;
  }
  return null; // This short version checks the light DOM.
}

One level deeper. The finder listens on window in the capture phase, before handlers on elements. An earlier window capture listener that calls stopImmediatePropagation() can still silence it. So no report does not prove there is an iframe. Also check that you pasted into the right frame and had not already used the finder. If the press went into an iframe, select it with the DevTools frame picker and paste again.

Check in this order:

  1. Is something else above your element? Check each item above it, plus ancestors that do not also contain your element. If one is a real control, move or resize one of the two. Otherwise inspect the first entry. Let presses through it, hide it or move it.
  2. Is your element missing from the stack? Walk up its ancestors for pointer-events: none. Check for visibility: hidden. It is inherited, so it may come from an ancestor. Check el.closest('[inert]'): an inert ancestor can leave computed pointer-events at auto. A showModal() dialog also makes outside content inert without that attribute. Check for a visible, unclipped box at that point. closest() stops at a shadow root, so check the host too.
  3. Is it first, but the handler never runs? Check for disabled if you expect a click. Check capture listeners higher up for stopPropagation() or stopImmediatePropagation(). Confirm your listener is on the current node, not one a re-render replaced.
  4. Is there no report? Rule out an iframe, an earlier listener, the wrong console frame and a used finder.
  5. Does it respond when it should not? Look for a child set to auto, a parent listener or keyboard input.
</> Why is my element missing?Show code
const el = document.querySelector('.save'); // your selector
for (let n = el; n; n = n.parentElement) {
  const cs = getComputedStyle(n);
  console.log(n, cs.pointerEvents, cs.visibility,
    n.hasAttribute('inert'));
}
console.log(el.closest('[inert]'),
  document.querySelector('dialog:modal'));

The HTML standard says hit testing must treat inert content like pointer-events: none. Test inert in this browser checks the sample with and without inert, then reports the stack result and computed value.

07

Pick the right off switch

pointer-events: none is a hit-testing tool. Use it for things that should not be a target: decorative overlays, a fade at the edge of a scroll area, a cursor follower, or the empty part of a full-width toast area. It also helps a fading card ignore a fast second click.

Do not rely on it to switch a control off. It leaves keyboard activation and scripted clicks in place. Choose the tool by what is off.

A form control: use disabled. It blocks activation and removes a native control from the Tab order. It does not promise silence from every pointer event. Before you disable a submit button until a form is valid, read Errors after you type.

A whole region, such as a closed drawer or the page behind a custom modal: use inert. It blocks pointer interaction and focus, and hides the region from assistive technology. It works in current Chrome, Edge, Firefox and Safari. A native <dialog> opened with showModal() makes outside content inert for you. Closed panels, like those in Accordions without the jump, are a good place for it.

A control people should still find: keep it focusable, set aria-disabled="true", block activation in script and say why it is off.

A layer fading out with opacity keeps catching clicks. Add pointer-events: none when the fade starts and visibility: hidden when it ends. If the layer contains controls, also make it inert and move focus somewhere useful. Fading out of display: none shows the timing. With reduced motion, remove the layer without the fade.

The short version. pointer-events affects which element is hit. It does not decide which ancestors hear the event, and it does not disable the keyboard.

Quick answers

Why is pointer-events: none not working?
The property only removes an element from pointer hit testing. It can seem to fail when a child sets pointer-events: auto, another element or iframe receives the press, or someone uses the keyboard. A parent set to none can also still hear events from a clickable child. Check which element is the event target and search your CSS for auto.

Why is a child still clickable when the parent has pointer-events: none?
The property is inherited, but a child’s own rule overrides the inherited value. A child with pointer-events: auto can be clicked even when its parent is set to none. The click then travels through the parent, so the parent’s event listeners still run. Check your own stylesheets and component libraries for auto.

Does pointer-events: none disable a button or link?
No. It stops the element from being a pointer target, but a focused button or link can still be activated from the keyboard, and scripts can call click(). For a form button, use the disabled attribute. For a link that should remain discoverable, keep it focusable, add aria-disabled="true", block activation in a click handler, and explain why.

How do I find which element is blocking my clicks?
Call document.elementsFromPoint(x, y) with the pointer’s clientX and clientY. It returns hit-testable elements from front to back, so check what appears above your control. Elements computing pointer-events: none or visibility: hidden are left out. Inert content is left out too, even though it can still compute pointer-events: auto. A pseudo-element is reported as the element that owns it. Presses inside an iframe do not reach the parent page’s pointer listeners.

Why can’t I scroll an element inside a pointer-events: none wrapper?
Wheel and touch scrolling also depend on hit testing. A scrollable list normally inherits none from its wrapper, so your wheel or finger scrolls whatever is underneath. Set pointer-events: auto on the list to make it a pointer target again. The wrapper can stay at none, letting presses pass through its other areas, unless other children opt back in.

New deep dives, in your inbox.