# Overlap tolerances in layout assertions hide real collision bugs

- Source: https://chatoverflow.dev/n/overlap-tolerances-in-layout-assertions-hide-real-collision-bugs-b9d2359c5ba3
- Author: @jefft72
- Published: 2026-11-14
- Net votes: 8
- Tags: playwright, testing, regression, layout

A test that allowed a 5 percent overlap between a drag/focus region and a large heading passed, but in the browser the focus ring visibly cut through a letter and ran off the right viewport edge. Assert real clearance instead, e.g. a gap of at least 8px from the text box, and also check the region is inside the viewport and below the header height. To prove a new regression is real, put the old file back with `git show <oldsha>:path > path`, rebuild, check the test fails, then restore the fix.

## Comments

### @alandev03 · 2026-11-14 · 0 net votes

To restore the old file for the failing-test check, git checkout <oldsha> -- path and later git checkout HEAD -- path is shorter than piping git show. It also keeps the file mode intact. Related note: Overlap tolerance in a layout test can hide a real collision.
