-
Notifications
You must be signed in to change notification settings - Fork 794
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
Tiled Gallery: Set Max Columns #21862
Conversation
…gallery. Allowing dynamic columns for porttrait/landscape.
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. 🔴 Action required: Please add missing changelog entries for the following projects: Use the Jetpack CLI tool to generate changelog entries by running the following command: Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped. Jetpack plugin:
|
Since this PR aims to fix two issues, I'll respond to each separately.
My initial impression is that this PR allows the editor to display the number of columns set in the block attributes. This differs from the core Gallery, which on my phone uses two columns in portrait orientation, and four columns in landscape orientation. This issue describes an implementation matching that of the core Gallery. Given our goal of having a shippable block by Dec 1, for now, I think it's best to stick to this. If we agree, the next step might be to implement the same logic the core Gallery uses to control how many columns to display.
Going through the behavior described in wordpress-mobile/gutenberg-mobile#4138 (comment):
This is working for me, e.g. if I have 10 images I can set the columns block attribute to 10.
In my testing of this PR, the default columns block attribute always stays at two. In the above mentioned comment, we discussed matching the Tiled Gallery web by making the column block attribute default to the number of images – if there are three or less images – or default to three if there are more than three images.
This doesn't appear to be implemented. For clarity, I think it would be best to handle each of these issues in a separate PR. We could then either re-work this PR to fix just one of the issues, or close it in favor of new PRs. |
I'm just un-assigning myself reviewer since I should have made the above comment a review. |
To match with the gallery block, the number of displayed columns in the editor is set to a maximum of two for portrait or four for landscape mode.
The default column number will be addressed in a separate PR.
dynamicColumnsNumber() accepts "window" as a paremeter, rather than a number. As such, the function wasn't being correctly called in previous commits. That's fixed with this commit.
With this commit, the web's MAX_COLUMNS constant is used (currently set to 20) in order for the native block to align with the web's behaviour.
The thinking behind this is that the maxDisplayedColumnsNumber() function is no longer being called within the settings function and is solely related to the appearance of the columns in the editor.
@guarani, this PR's ready for review again. :) It includes the following functionality:
I've created separate issues for tracking the outstanding issues you've noted, including updating the default value for columns to match the web and hiding the setting when there's only one image:
Looking forward to hearing your thoughts! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @SiobhyB! I gave this a test and the functionality is working as described, although I ran into one blocker and one very minor issue.
Images don't resize properly when changing columns setting
In the below video, as I switch between one and two columns, the Tiled Gallery's layout seems to break. Do you know if this is a separate issue, or is it specific to this branch?
layout-breaking.mov
Column stepper increment button isn't disabled when at max columns
The Gallery block disables the increment button (of the column stepper) when the user column setting is at its maximum value. This is definitely not a blocker and feel free to create a separate issue for it to address later (e.g. after Phase 1B).
A heads-up that the failure in the |
@guarani, thank you for the review! I was able to replicate the issue with images not resizing correctly on the main feature branch, so will create a separate issue for it. I'll also create a separate issue for the increment button 🙇♀️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@guarani, thank you for the review! I was able to replicate the issue with images not resizing correctly on the main feature branch, so will create a separate issue for it. I'll also create a separate issue for the increment button 🙇♀️
Ok, thanks for checking that! Approving now 🙇
Sets the max columns allowed to the number of images.
Allows columns to resize when used in landscape/portrait mode.
Fixes #4147
Fixes #4138
Gutenberg Mobile PR: wordpress-mobile/gutenberg-mobile#4441
Changes proposed in this Pull Request:
MAX_COLUMNS
value of 20 (defined here in the block'sconstant.js
file).Does this pull request change what data or activity we track or use?
N/A
Screenshots
screen-20211123-144305.mp4
Testing instructions:
Test 1
Test 2