fix: ensure flickering grid covers full container edges #839
+20
−20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The
FlickeringGridcomponent leaves gaps on the right and bottom edges when container dimensions aren't perfectly divisible by(squareSize + gridGap).Using
Math.floor()truncates the division, rendering only complete cells and leaving remainder space uncovered.Example:
squareSize (6px) + gridGap (12px)= 18pxMath.floor(500 / 18)= 27 → 486px coverage → 14px gap on right edgeMath.floor(262 / 18)= 14 → 252px coverage → 10px gap on bottom edgeSolution
Changed
Math.floor()toMath.ceil()on lines 58-59 to ensure enough grid cells are rendered to cover the entire container.After fix:
Math.ceil(500 / 18)= 28 → 504px coverage → full edge-to-edge coverageMath.ceil(262 / 18)= 15 → 270px coverage → full edge-to-edge coverageAny squares extending beyond the container boundaries are clipped by CSS
overflow: hidden, resulting in seamless visual coverage without performance impact.Visual Impact
Before: Inconsistent gaps on right/bottom edges depending on container size
After: Pixel-perfect edge-to-edge coverage in all cases
Demo
demo-fix-flickering-grid.mp4