Extract magic number to named constant in keyboard navigation #17
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Public/castroix!17
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "copilot/sub-pr-16"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The keyboard navigation column calculation used a magic number
400without documenting its relationship to the CSS grid layout (minmax(300px, 1fr)).Changes
400toCARD_WIDTH_WITH_GAPconstant with documentation linking it to CSS grid settingsThis makes the relationship between JavaScript navigation logic and CSS grid layout explicit, improving maintainability if grid settings change.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
Pull Request Overview
This PR extracts a magic number (
400) used in keyboard navigation column calculations into a well-named constant (CARD_WIDTH_WITH_GAP) with documentation explaining its relationship to the CSS grid layout. This improves code maintainability by making the connection between JavaScript navigation logic and CSS grid configuration explicit.Key changes:
CARD_WIDTH_WITH_GAPconstant with documentation linking it to CSS grid settings💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
@ -5,1 +5,4 @@// Grid layout constants// This should match the CSS grid-template-columns: repeat(auto-fit, minmax(300px, 1fr))// The value accounts for minimum card width (300px) + gap (40px) + padding considerationsThe comment mentions "padding considerations" but it's unclear how this contributes to the 400px value. The CSS shows: minimum card width (300px) + gap (40px) = 340px. The grid container has
padding: 40px 80pxwhich applies to the container edges, not per-column spacing. Consider clarifying what specifically accounts for the remaining 60px (400 - 340) in this calculation, or if 400px is an intentional approximation/buffer to prevent edge cases where cards might wrap unexpectedly.