WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.5k stars 4.19k forks source link

Grid: Add `max` to 'Row span' and 'Column span' controls #63967

Open noisysocks opened 3 months ago

noisysocks commented 3 months ago

Feedback from @jameskoster:

It feels a bit unexpected that I can set row span to a greater number than the actual number of rows in the grid, especially in auto mode. In manual mode should it increase the row value on the parent?

We have a max on the <input> for the Row and Column controls so I think a sensible fix here would be to similarly set a max on the Row span and Column span controls.

The max needs to take into account the position of the grid item. For example if a grid item is in the second last column then its max column span should be 2.

It might be nice to have these controls automatically increase the parent grid's size one day but for now I think the important thing is that we're consistent across all of the grid controls. Right now the placement controls have a max but the span controls don't—weird!

vipul0425 commented 2 months ago

Hi @noisysocks I have raised a PR for this. Let me know if you have any suggestions.

Thanks.