Overlapping hit regions need explicit priority rules
Aliases: hit-test priority · hit-test order · overlapping controls
What it is
Hit-test precedence specifies which object receives an event when an input location falls in several interactive regions. Visually layered popovers, nested controls, and transparent tolerance margins create this ambiguity. Without an explicit rule, behaviour can depend on rendering order or implementation accident.
Why it happens
Hit testing commonly traverses visual layers from front to back, or dispatches through capture and bubble paths. Precedence maps one coordinate to one action and prevents a click from triggering several objects. When visual, event, and expanded-hit-region layers differ, a background object can steal input from the foreground object people see.
Studying it
Construct layered popovers, adjacent expanded regions, nested buttons, and dynamically appearing objects. Record the target, event path, and any event pass-through at the same location. Cover scaling, touch and mouse, and intermediate animation frames; static unit tests miss ambiguities during layer changes.
Where it stops holding
Frontmost-first is not the only policy: composite controls may require parent handling, modal layers must block backgrounds, and canvas editors can use object-selection rules. The essential requirement is consistency with visual and task semantics, not mechanically copying DOM or draw order.
Applying it
- Define testable precedence for each overlap class: modal blocking, foreground priority, parent capture, or explicit selection.
- Keep noninteractive visual layers out of hit testing so transparent decoration cannot swallow events.
- Automate clicks and touches at overlap boundaries, asserting one target and the intended dispatch path.
Related
- Same group: C1.05.1 A hotspot is the single reference location within a cursor graphic · C1.05.2 A cursor's visual centroid and hotspot can create systematic offset · C1.05.3 A hit region can exceed its visual region
- Nearby: C1.08 Drag and drop · E1 Interface elements and controls
- Search terms:
hit-test precedence·event dispatch·overlapping targets