-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Nav block: Fix onselect jump #31198
Nav block: Fix onselect jump #31198
Conversation
Size Change: +385 B (0%) Total Size: 1.39 MB
ℹ️ View Unchanged
|
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.
I tested this and in the specific test case provided it worked as expected.
However, there might be an edge case.
- Create Nav Block.
- Click
Start empty
. - Deselect the Nav Block by clicking outside.
- See placeholder state in the Nav Block. Note the height this occupies.
- Click back into the Nav block. Note that the height now changes.
Screen.Capture.on.2021-04-27.at.10-39-17.mp4
Perhaps we need an is-empty-state
class which we can use to qualify the is-selected
rule to apply the min height on in that state?
Other than that it is good but I wonder perhaps whether the rule you have removed was originally designed to cater for the edge case I described above. If it was then it should have had a code comment to indicate this so if we fix it we should do that.
1efd3b4
to
e4c5c18
Compare
Excellent steps of reproduction, I had somehow missed that bit. Thanks so much for your time here. Your comments made me think of a way to maybe solve this, so I've pushed two fixes. But for either fix, there will be a small jump, so it's a question of where we want to make the jump. First I pushed a fix to make it like this: What happens there is that there's an invisible space being output. That space character happens to be the same height of a menu item, which means there's no jump between an empty nav block and one with menu items. I went a step further and removed the minheight entirely in favor of such a paragraph, so that now the gray skeleton indicators are also 1 menu item tall: In both cases, there's a small jump. I believe this to be inevitable with the current way the navigation menu placeholder state is created, because a blue block editor button will always be the height of a blue block editor icon. I think there's further thought we can do to both the skeleton indicators and the placeholder state, but perhaps this is a good interim fix? |
Thanks to all your great reviews, I actually realized some limitations in the approach here. In looking at an adjacent issue, I ended up fixing the same issue there, so I am closing this one in favor of #31371. |
Description
The nav block had a min height on select, which caused a jump:
This PR fixes that:
Why was it there? Well, the placeholder state needs it to not collapse. But it doesn't need it in the configured state:
How has this been tested?
Test a navigation block, both empty and populated, horizontal, check that it looks good.
Checklist:
*.native.js
files for terms that need renaming or removal).