Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix regression with column block being selected. #14876
The columns block is currently slightly fiddly, due to the nesting nature of Columns > Column > Blocks structure. All three levels are "Blocks" in the block editor sense, and all can be selected. This is pending enhancements in #9628.
However in the mean time, we have a hack in place, this uses
That hack regressed in master. This PR restores it, and makes it slightly better.
Things to test:
aduth left a comment
Is there any sense of how this regression happened? Given the presence of
Thank you for the review!
No, I'm not quite sure. I'm assuming it happened due to the classname changes that were part of the move to a generic block editor, but I'm not totally sure. From just parsing the existing rules, it could be a change in the markup — the previous rules were heavy on adjacent sibling selectors, so even a single added fragment to some of the block markup or to the block editor itself could do it.
The new markup should be slightly more resilient in that vein, even though I still consider it "stopgap". Given that the selectors are simpler now, and do not rely on :not's, I would suggest this makes it more resilient, but I'd appreciate thoughts on how to better accomplish this.
No, you can still select these using the keyboard through arrowkey navigation through blocks, it steps through every nested block.
Or you can use the mouse to select the block navigation button at the top, to pick those.
I agree it would be nice to easily select the column block by simply clicking in the block itself, but I believe that's why we need to prioritize #9628 as the better solution for that. In the mean time, we have a choice between making it possible to select the columns block where you can set the amount of columns and overall vertical alignments, OR, select the individual column blocks where you can set the vertical alignment of individual columns. This PR suggests the former is more valuable, until we can have both (through #9628).
kjellr left a comment
This sounds great — I totally agree. I'm hoping to start pushing on #9628 soon, so hopefully we can get that in place. In the meantime, this helps make selecting column blocks easier in general.
This PR in general is working well for me. I'm unable to select individual columns with the mouse, but I can do so with the keyboard.
It sounds like that discussion above around reusable blocks is resolved too, so if that's the case this seems good to go.