Skip to content

Account for dynamic padding on flex container #2

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

Merged
merged 4 commits into from
Mar 18, 2025

Conversation

chasegiunta
Copy link
Owner

This pull request introduces several enhancements and optimizations to the flexbox wrapping detection logic. The changes focus on improving performance, handling padding more effectively, and ensuring accurate wrap state detection.

Enhancements to flexbox wrapping detection:

  • src/main.ts: Introduced containerUnwrapWidths and activeUpdates to manage unwrapped widths and prevent flickering during updates.
  • src/main.ts: Added getHorizontalPadding function to calculate total horizontal padding of an element, which is used to determine if items would fit without wrapping.
  • src/main.ts: Improved the markFlexboxAndItemsWrapState function to handle force wrapping, unwrapping, and padding adjustments more accurately.
  • src/main.ts: Added a MutationObserver to monitor style and class changes that might affect padding, ensuring the wrap state is updated accordingly.

Documentation updates:

  • docs/App.vue: Added a new example to demonstrate how padding applied to a parent flexbox affects wrap detection. [1] [2]

Copy link

netlify bot commented Mar 18, 2025

Deploy Preview for wrap-aware ready!

Name Link
🔨 Latest commit 3ab735b
🔍 Latest deploy log https://app.netlify.com/sites/wrap-aware/deploys/67d9f48a203a3500081cbe47
😎 Deploy Preview https://deploy-preview-2--wrap-aware.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@chasegiunta chasegiunta merged commit 82f54aa into main Mar 18, 2025
4 checks passed
@chasegiunta chasegiunta deleted the account-for-padding branch March 18, 2025 22:48
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.

1 participant