Skip to content
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

Add a global option to clear floated blocks. #10299

Open
jaclyntan opened this issue Oct 3, 2018 · 12 comments
Open

Add a global option to clear floated blocks. #10299

jaclyntan opened this issue Oct 3, 2018 · 12 comments
Labels
CSS Styling Related to editor and front end styles, CSS-specific issues. [Feature] Blocks Overall functionality of blocks Needs Dev Ready for, and needs developer efforts [Type] Enhancement A suggestion for improvement.
Milestone

Comments

@jaclyntan
Copy link

jaclyntan commented Oct 3, 2018

I tried using the button feature today and for the most part it works perfectly, however if I try to align it, the alignment seems to affect the entire block, making it align weirdly/nest with the other blocks. See screenshots to see what I mean
screen shot 2018-10-03 at 6 40 10 pm
screen shot 2018-10-03 at 6 38 09 pm
I assume this is intended because some people might want the buttons within a paragraph of text...? But once an alignment is set on the button it's really hard to reorder the button because the arrows are blocked by the plus button when hovered. Also when the block is within another block it conflicts the hover states between each block.

Also the button block would even more useful if we could also have the ability to add custom classes and title attributes, as well as set a target ie. target="_blank"

Thank you!

@designsimply designsimply added [Feature] Blocks Overall functionality of blocks Needs Testing Needs further testing to be confirmed. labels Oct 3, 2018
@jaclyntan jaclyntan changed the title Aligning a button affects its entire block Aligning a button affects other blocks Oct 3, 2018
@webtrainingwheels
Copy link

I can reproduce this issue with the alignment affecting other blocks. I think it's essentially the same issue as this one: #4127
Basically related to clearing the floats.
Even though you may add a new "block" below your button, the alignment of the button is not cleared, so it will indeed affect the next "block".
It's unexpected because the notion of a "block" is of a self-contained unit which should be unaffected by others, unless specifically nested.

@webtrainingwheels
Copy link

@jaclyntan Just an FYI, I found a dedicated issue related to reordering the button block when alignment is applied. I think this is the trouble you are also having?
#9401

@jaclyntan
Copy link
Author

@webtrainingwheels good catch I think that is the same issue. I think it's to do with clearing floats too. The main problem is that the floating inteferes with how the block is able to be removed/edited.

The concept of aligning these blocks is quite confusing as well since I did not expect the button to be aligned in the previous block with a float. I expected the button to the floated right or left within it's own section if that makes sense.

I think the Image blocks may use the same alignment functionality though, but since buttons are smaller in size it's block probably runs into more conflicting issues when floated within other blocks.

I'm not against using floats to align these elements- just as long as the UI doesn't clash within other blocks ^^

@ellatrix
Copy link
Member

The movers have been fixed, see #9401 (comment).

Currently it's indented that the buttons float, so that they have other blocks around them. Perhaps there should also be an option to clear the float so that there is nothing around the button? Cc @jasmussen maybe?

@ellatrix ellatrix changed the title Aligning a button affects other blocks Button: aligning put content around the block Jun 24, 2019
@ellatrix ellatrix added [Block] Buttons Affects the Buttons Block Needs Design Feedback Needs general design feedback. and removed Needs Testing Needs further testing to be confirmed. labels Jun 24, 2019
@jasmussen
Copy link
Contributor

Perhaps there should also be an option to clear the float so that there is nothing around the button?

Not entirely sure I understand the context. There's also a separate PR or decision around how/where to show the button URL, i.e. in a popout bubble. This would fix some of the indentation you see here:

indentation

But to answer your specific question, should there be an option for a block to clear floats or "self clear"? This issue has come up a number of times, enough to suggest that yes, there probably should be. And maybe this option should even be global to all blocks and we could put it down here in the advanced section, because it really is an advanced thing to do:

Screenshot 2019-06-24 at 15 28 31

@sarahmonster
Copy link
Member

The design team discussed this during a triage session in Slack today (Note: You may need a Slack account to log in.)

The overall consensus was that, whilst floats are problematic from a user experience perspective, we need a way of being able to better and more predictably work with them. @joen's solution suggested here, of providing an option to clear a float on a per-block basis, seems like a good compromise solution that will take some of the sting out of the experience for some users, and as such we should do it.

Given the complexity of understanding how floats behave, we'd definitely advise for making it an advanced option as suggested here as well. 👍

@sarahmonster sarahmonster added Needs Dev Ready for, and needs developer efforts and removed Needs Design Feedback Needs general design feedback. labels Jul 9, 2019
@youknowriad youknowriad changed the title Button: aligning put content around the block Add a global option to clear floated blocks. Aug 19, 2019
@youknowriad youknowriad removed the [Block] Buttons Affects the Buttons Block label Aug 19, 2019
@talldan talldan added the [Type] Enhancement A suggestion for improvement. label Aug 21, 2019
@joyously
Copy link

I think that Clear should be with the other alignment options, as an additive property.

@paaljoachim
Copy link
Contributor

Another float issue. Just adding it in here:
#13784

@noisysocks noisysocks added this to the WordPress 5.x milestone Oct 3, 2019
@noisysocks
Copy link
Member

This ticket was mentioned during a #core-editor chat.

This is ready for a dev to pick up, and implementing it would fix #13784.

@jasmussen
Copy link
Contributor

I just created #21608 which outputs CSS to clear floats when a block is centered.

We might very well decide to not do that, based on discussion. But at least then we will have decided that this particular issue is the one to solve!

@tellthemachines
Copy link
Contributor

Given @jasmussen 's work above, is there anything still required for this ticket? Or is it good to close?

@tellthemachines tellthemachines added the CSS Styling Related to editor and front end styles, CSS-specific issues. label Apr 23, 2020
@jasmussen
Copy link
Contributor

jasmussen commented Apr 23, 2020

is there anything still required for this ticket?

I'm not sure. In CSS you can apply clear: both; to any element, to fix the quirks of floats. It feels fair enough to allow this float clearing on a per-block basis just like applying a CSS class.

Also — sorry for closing and reopening, an embarrassing mis-click!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS Styling Related to editor and front end styles, CSS-specific issues. [Feature] Blocks Overall functionality of blocks Needs Dev Ready for, and needs developer efforts [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests