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

Grid block: add "auto-fit" option #57186

Open
bradhogan opened this issue Dec 18, 2023 · 5 comments
Open

Grid block: add "auto-fit" option #57186

bradhogan opened this issue Dec 18, 2023 · 5 comments
Labels
[Feature] Layout Layout block support, its UI controls, and style output. [Type] Enhancement A suggestion for improvement. [Type] Experimental Experimental feature or API.

Comments

@bradhogan
Copy link

Description

Running into an issue when using the grid block and seems this would be a quick fix. Rather than using auto-fill in the grid-templates-column if we switch to auto-fit, seems to work better to help those columns fill the space.

Step-by-step reproduction instructions

  1. Add grid block (need grid experiment checked in gutenberg settings)
  2. Add three groups within the grid (so there are three columns)
  3. Select the grid block - set to "full width" then also update the width for the interior groups to "200px"
  4. View on desktop
  5. Notice the empty whitespace (does not fill entire section)
  6. If you change repeat(auto-fill, minmax(min(200px, 100%), 1fr)) to repeat(auto-fit, minmax(min(200px, 100%), 1fr)) in the console, you'll see it fixes the issue.

Screenshots, screen recording, code snippet

https://soapbox.wistia.com/videos/1IWnsyoL8e

Environment info

  • wp 6.4.2
  • gutenberg 17.2.3
  • mac sonoma
  • chrome

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@bradhogan bradhogan added the [Type] Bug An existing feature does not function as intended label Dec 18, 2023
@jordesign
Copy link
Contributor

Thanks for the report @bradhogan - I'm unclear what block you're referring to by the 'Grid' block as that doesn't sound like one of the Core Gutenberg blocks. Could you please tell me a little more?

@jordesign jordesign added the [Status] Needs More Info Follow-up required in order to be actionable. label Dec 18, 2023
@bradhogan
Copy link
Author

@jordesign in the admin menu, go to Gutenberg > Experiments > check to turn the grid block on (it's part of the Group block)

@jordesign
Copy link
Contributor

Ah - thanks - the experimental grid block. Thanks for confirming.

@jordesign jordesign added [Type] Experimental Experimental feature or API. [Feature] Layout Layout block support, its UI controls, and style output. and removed [Status] Needs More Info Follow-up required in order to be actionable. labels Dec 18, 2023
@tellthemachines
Copy link
Contributor

Thanks for creating this issue! The use of auto-fill was deliberate, because a single item or two items in a grid shouldn't always stretch to fill their whole container. The intention is to make this behaviour configurable in the future, but to start with auto-fill was chosen as a default so that the width of contents never varies too much from the defined minimum width.

I'll leave this open and re-label it as an enhancement to add auto-fit as an option.

@tellthemachines tellthemachines added [Type] Enhancement A suggestion for improvement. and removed [Type] Bug An existing feature does not function as intended labels Jan 8, 2024
@tellthemachines tellthemachines changed the title Grid block: change "auto-fill" to "auto-fit" Grid block: add "auto-fit" option Jan 8, 2024
@germanfrelo
Copy link

Yes, please, implement the auto-fit option to the (now stable) Grid layout 🙏🏻.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Layout Layout block support, its UI controls, and style output. [Type] Enhancement A suggestion for improvement. [Type] Experimental Experimental feature or API.
Projects
None yet
Development

No branches or pull requests

4 participants