Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle negative margins #31

Merged
merged 2 commits into from
Oct 25, 2024
Merged

Conversation

mdonnalley
Copy link
Contributor

Prevent negative margins by

  • defaulting to 0 for left and right margin when the column width is the exact same as the content width
  • using Math.max(0, margin)

Copy link
Member

@cristiand391 cristiand391 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGMT 👍🏼
Math.max could return NaN if some value is/gets coerced to NaN:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max

maybe calculateMargins could do an early check to catch possible wrong-calculated spaces (Number.isNaN(spaces))?
otherwise Math.max(0, NaN) always return NaN

@cristiand391
Copy link
Member

QA notes:

before

Screenshot 2024-10-25 at 1 30 17 PM

after

Screenshot 2024-10-25 at 1 31 42 PM

@cristiand391 cristiand391 merged commit 5c6395f into main Oct 25, 2024
11 checks passed
@mdonnalley mdonnalley deleted the mdonnalley/handle-negative-margins branch October 25, 2024 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants