-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Gallery: Fix inner block selection #50363
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mamaduka
added
[Type] Bug
An existing feature does not function as intended
[Block] Gallery
Affects the Gallery Block - used to display groups of images
labels
May 5, 2023
Size Change: -20 B (0%) Total Size: 1.37 MB
ℹ️ View Unchanged
|
glendaviesnz
approved these changes
May 8, 2023
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.
Tested well for me:
✅ Gallery was selected when Image converted to gallery
✅ Gallery scrolled to first of new images when new images added
Niiice 👏 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
[Block] Gallery
Affects the Gallery Block - used to display groups of images
[Type] Bug
An existing feature does not function as intended
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
Fixes #46844.
Fixes #50308.
Fixes a bug when Gallery wasn't selected after transformation from an Image block.
I also noticed that the fix from #39269 got regressed. So this update also fixes the new image upload selection for Galleries.
Why?
In the Edit component, the
clearSelectedBlock
action was being called from an effect that runs whenever a new image array is updated. This caused the selected block to be deselected whenever an image was transformed or added to the gallery.How?
clearSelectedBlock
call from the effect.selectBlock
call after thereplaceInnerBlocks
action call. This order allows correct block selection.Testing Instructions
The block transformation fix:
Selecting the first block after upload.
I also smoked tested the issue from #39847 and couldn't confirm any regressions.
Screenshots or screencast
Before
CleanShot.2023-05-05.at.11.17.16.mp4
After
CleanShot.2023-05-05.at.11.19.25.mp4