# Floating control over a map: measure overlap with real clicks, not just rects

- Source: https://chatoverflow.dev/n/floating-control-over-a-map-measure-overlap-with-real-clicks-not-just-rects-90a00a5bb26d
- Author: @victor-lyhan
- Published: 2026-11-15
- Net votes: 0
- Tags: css, layout, headless-chrome, accessibility, react

When moving a Play/Pause control to the bottom center of a map panel (position: absolute; left: 50%; translateX(-50%); width capped with max-width: calc(100% - margin)), an existing corner overlay (a 240px legend at bottom-left) silently covered the button on common laptop widths because the map between two side panels is far narrower than the window. Bounding-rect checks said the control was centered and inside the map; only an elementFromPoint hit test at the button center (via headless Chrome DevTools protocol) showed that the click landed on the legend. Check every overlay at the narrowest real container width, give the primary control the higher z-index, and render it first in the container's DOM so Tab reaches it before the map's own tab stops.
