WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.52k stars 4.21k forks source link

Block Controls - rename `align` to `position` and repurpose `align` to mean `justify` #19672

Open getdave opened 4 years ago

getdave commented 4 years ago

Yes, I thought we were discussing using alignment for the distributions of elements within the container (left, center, space-between, etc) and position for how the container is displayed (wide, full-width, floated, etc).

Originally posted by @mtias in https://github.com/WordPress/gutenberg/pull/19386#issuecomment-572744034

Description

(If I understand him correctly) Matias raised a point about potentially renaming Block “Align” controls to “Position” and repurposing “Align” to mean something more akin to “Justify”.

To be clear, the new terminology would be:

  1. Position - how the container is displayed (wide, full-width, floated, etc).
  2. Align - for the distributions of elements within the container (left, center, space-between).

This would be a significant change because align is already in use to mean float / width.

Questions

See also this WP Slack "conversation".

karmatosed commented 4 years ago

I don't mind on surface changing these but justify means something so rather we don't use that term. For me this makes sense:

mapk commented 4 years ago

This makes a lot of sense to me in the way of terminology and how the current align functionality is more about positioning.

I imagine this will cause the classes to change from alignwide or alignfull to something more like positionwide or positionfull. This seems like a pretty big impact for themes. cc @kjellr @allancole.

kjellr commented 4 years ago

I imagine this will cause the classes to change from alignwide or alignfull to something more like positionwide or positionfull. This seems like a pretty big impact for themes. cc @kjellr @allancole.

That's a good point. This is obvious but if we do change those classnames, we'll just need to ensure backwards compatibility with all the themes that use those (both in the front end and editor). That's generally fine, but my only hesitancy is just that it'll require including a lot of extra CSS make that happen.

joyously commented 4 years ago

I imagine this will cause the classes to change from alignwide or alignfull to something more like positionwide or positionfull. This seems like a pretty big impact for themes.

If you had listened, back at the beginning, we wouldn't be in this now... #11881

Position also has a meaning in CSS, which doesn't match up with the new usage. Perhaps separating the width options from the side to side options would make it clearer. Block alignment and Text alignment and Text distribution (or Content distribution or Content spacing or Content arrangement) are all separate from Width. But it seems that Block alignment has the most legacy and shouldn't e the one that changes.

getdave commented 4 years ago

@joyously Thanks for your feedback. This issue obviously has a history which I wasn't aware of. I'm ready and willing to work with you and others to help move this forward if there is broad support for it (and it seems like there is!).

Position also has a meaning in CSS, which doesn't match up with the new usage.

I definitely take your point here. The question I'm asking myself is do most users think in terms of CSS? I appreciate position in CSS is different but I'd like to get some perspective on what someone who doesn't know anything about the technical side of websites feels about this term.

As you mention another option could be "Layout".

Perhaps separating the width options from the side to side options would make it clearer.

Personally I think we may need to consider this. As things stand you can't have both "width" and "alignment" (read float left/right) applied together. The downside to splitting these would be adding additional buttons to the UI.

ZebulanStanphill commented 4 years ago

It should be noted that aligncenter is, unlike all the other align___ classes, actually an alignment, so it may belong in a separate toolbar from the other options.

There are at least 4 different things here:

ZebulanStanphill commented 4 years ago

Another thing to note is that floating, pulling out of the main column, and wide/full widths are all mutually exclusive: it doesn't make any sense to use two of these at the same time. Because of that, it may make sense to put them all in the same toolbar. However, they should probably still use more descriptive names and not just share the term "align".

ZebulanStanphill commented 4 years ago

(Continued from my previous comment...) The options in this combined toolbar could be labeled as follows:

I have no idea what you would call this toolbar as a whole, though. Block flow options, perhaps?

joyously commented 4 years ago

Even if users don't know what Position in CSS is, I still don't think you should use it because future enhancements might include actual position choices, such as relative, absolute, fixed, or sticky.

allancole commented 4 years ago

This is obvious but if we do change those classnames, we'll just need to ensure backwards compatibility with all the themes that use those (both in the front end and editor). That's generally fine, but my only hesitancy is just that it'll require including a lot of extra CSS make that happen.

Overall, I think accurate naming in general will help users understand the UI better. But I’m also super hesitant about backwards compatibility related to changing this.

I personally feel it’s better to let Gutenberg control how these classes work exclusively. The only thing a theme designer is ever concerned with related to these classes is the resulting widths of a block once rendered. With just a few variables like $content-width=800px, $wide-content-width=1200px, $position-behavior=pull/float. themes could influence the alignment classes without actually writing selectors that are subject to change in core later (as suggested here).

Also want to point out that content widths are probably the only place where it might makes sense to do something like this. We already have a global $content_width variable in PHP that controls the width of media and embedded content to make content fit a theme’s design. This feels like the same kind of decision here with some added complexity for wide and floating behaviors.

I find that it’s too easy to break things when fiddling with or overriding the alignment classes especially with responsive styles which are really hard to solve in a theme. A lot of time you don’t even know you’re doing it wrong until much later when a class name changes in core or a new block gets introduced that needs to work differently.

jasmussen commented 4 years ago

There is some discussion happening in https://github.com/WordPress/gutenberg/pull/19944 which touches icon naming. It's not extremely critical that we get it 100% right at this point in time, because those icon names are easy to change. But in case you'd like to share input, it's a good opportunity to do so.

ZebulanStanphill commented 4 years ago

Reposting https://github.com/WordPress/gutenberg/pull/20689#discussion_r389122339 here to get some feedback on some class name ideas:

If we were to put them all under a single naming scheme, I'd go with something like this:

wp-position-xxx with the xxx replaced with one of the following for each of the possible values:

I'm not sure whether wp-position- is the right naming scheme, though. CSS already has a thing called position that isn't really the same concept. Perhaps it may also be worth distinguishing from potential vertical options by using wp-horizontal-position- or wp-x-position- or something like that.

But I'm not convinced that different options should use the same naming scheme if they're technically different things. If we were to use more diverse names depending on what exactly the position/alignment/whatever actually is, I would go with something like the following:

I prefer this naming scheme since it's more concise, and doesn't try to fit a redundant, possibly incorrect word like "position" into the class names.

jasmussen commented 4 years ago

In general the naming convention seems worth it to me — and "worth it" is something it has to be because it's a big change.

I would avoid a wp- prefix, though, as it does not seem to add any value, just some "branding" if anything.

kjellr commented 4 years ago

I would avoid a wp- prefix, though, as it does not seem to add any value, just some "branding" if anything.

The main benefit to something like this would be that it wouldn't interfere with any more generic classnames that older themes may be using. That said, I do agree... I think it's relatively (probably?) safe to just use these without a prefix.

jasmussen commented 4 years ago

The main benefit to something like this would be that it wouldn't interfere with any more generic classnames that older themes may be using.

If these new alignments are opt-in, which they are in #20689, this might be a non-issue. I.e. we could make the opt-in be in the code rather than in the CSS with the prefix.

jordesign commented 1 year ago

@jasmussen Just checking in to see if this is a discussion/decision that still needs resolution?

jasmussen commented 1 year ago

I think at this point it largely boils down to the feasibility on the implementation side. What's actually pragmatically possible at this point. Perhaps @tellthemachines has some insights?