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

[4.x] Fix ButtonGroup from overflowing #10000

Merged

Conversation

PatrickJunod
Copy link
Contributor

Change:

This PR introduce a ResizeObserver for the ButtonGroup to handle the Overflowing cases.

Fix: #9044
Fix: #9830 (Indirectly by removing the width: 1% of the button-group.css file - which was interfering with this)

Some observations:

  • I did not test the performance of such a change as I'm not sure what to look for ? If someone willing to do it and knowing how could have a look ?
  • I was not sure about the use of the button-group.css file. If needed, I can naturally put all css in the resources/css/elements/buttons.css file.

Example:

Example 1

When the button group can correctly be displayed as a flex row element, then the button still works the same:
image

Example 2

When the button group does not have enough place to be displayed correctly without overflowing, then it will be display as a vertical button group:
image

Example 3

This also works in other field types, like the replicator, grid, etc...:
Without overflowing:
image
With overflowing:
image

Or using the #9044 as an example:
Without overflowing:
image

With overflowing:
image

@jasonvarga jasonvarga merged commit 1df2d80 into statamic:4.x May 8, 2024
18 checks passed
@PatrickJunod PatrickJunod deleted the fix/buttons-overflowing-buttonstyle branch May 8, 2024 05:49
@robdekort
Copy link
Contributor

Just wanted to say thank you for this PR. And what a great number huh?

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.

Button Group inside Grid renders too small Button groups should wrap in small containers
3 participants