WordPress / gutenberg

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

Site logo: set square aspect ratio by default with opt out for themes #63382

Open annezazu opened 1 month ago

annezazu commented 1 month ago

To make the Site Logo block a bit more opinionated, let's consider setting the default option to square/1:1 with the option for themes to opt out or to provide a set aspect ratio that's better suited for the theme design. I'm curious to hear from @WordPress/gutenberg-design and @WordPress/block-themers around this too as this would change the default of how the site logo block would work. This would still leave the aspect ratio/cropping tools for users to change back and theme authors could override the default.

scruffian commented 1 month ago

This isn't trivial. The Site Logo block doesn't do any cropping on its own, it uses the WordPress tools to achieve this and when it saves the cropped image it syncs it back to the site icon. We could apply some cropping on the block via CSS but then this wouldn't apply to the site icon, so I would advise against it.

jasmussen commented 1 month ago

This would not be a hard crop, it would be a soft-crop, same as what the Aspect Ratio tool does for the Image block. So what I'm reading here, and agree with, is a desired behavior of new Site Logo blocks being inserted defaulting to have a 1:1 square aspect ratio applied to the placeholder. Further, that this aspect ratio, as well as width and height, persist even when you add an image, or add a different image, regardless of those other images aspect ratios or dimensions.

Here's a mockup that advances the site logo a little bit in that regard:

Site logo w  aspect ratio Site logo w  aspect ratio, and image

New in this mockup, compared to trunk:

These mockups show a slightly longer view, and we can start with less, such as simply adding the aspect ratio control, and making it persist between placeholder and final states.

richtabor commented 1 month ago

Should the add control be "Add logo" to be a bit more apparent?

jasmussen commented 1 month ago

Good point. I also missed updating the block toolbar when one is set. Here are fresh ones:

Site logo w  aspect ratio Site logo w  aspect ratio, and image

Figma.

carolinan commented 1 month ago

Related: https://github.com/WordPress/gutenberg/issues/40838

luminuu commented 1 month ago

I'd rather make this opt-in instead of forcing themes to opt-out. This will be annoying for existing themes if they're used on a site with a site logo set that isn't 1:1, that would suddenly become cropped or squished together. It might also be confusing for users why suddenly the logo is not working as expected, if they are used to the image being displayed with the original aspect ratio.

jasmussen commented 1 month ago

The way I'm understanding "opt-out" is this:

To that end, this is more of the default Site Logo block experience, than any separate theme opt-outs.

richtabor commented 1 month ago

To that end, this is more of the default Site Logo block experience, than any separate theme opt-outs.

That's my thinking as well.

Sam-Xronn commented 3 weeks ago

Isn't it time to remove the site logo block now?

It's purpose has been super seeded by recent updates to the site editor. I understand why it was initially added, but it continues to cause so many more issues than it solves, I'm unsure why we're continue to push this block.

ndiego commented 3 weeks ago

It's purpose has been super seeded by recent updates to the site editor. I understand why it was initially added, but it continues to cause so many more issues than it solves, I'm unsure why we're continue to push this block.

The Site Logo block is commonly used in most block themes, often in Header template parts. For those that don't need this block, it can easily be disabled.

Sam-Xronn commented 3 weeks ago

It's purpose has been super seeded by recent updates to the site editor. I understand why it was initially added, but it continues to cause so many more issues than it solves, I'm unsure why we're continue to push this block.

The Site Logo block is commonly used in most block themes, often in Header template parts. For those that don't need this block, it can easily be disabled.

It's commonly used due to it's early addition to the block editor not due to how useful it is. It no longer offers any apparent benefits compare to the image block. My concern is the continued waste of time diluting blocks into a level granularity not required. For example...

It's not about showing/hiding the block and more about a confusing and poor UX. Of course you'd select the logo block to use as your logo if it exists, only to find out it offers no value and remove it and add an image block. Huh!

ndiego commented 3 weeks ago
  • Logo block doesn't support custom links, although a design system existing for this (image block). Making it useless to anyone running WP on a subdomain e.g. jobs. events. store. blog. etc...
  • Favicon support added to settings >general making it redundant (it's only real benefit)
  • No support for multiple headers e.g. dark and light logos
  • No aspect ratio support

Fair points. I wonder if extending the Image block to include a few new controls, like "Use as site logo" and deprecating the Site Logo block, would be a possible approach. Backward compatibility might be a nightmare, but we could then introduce an Image block variation called Site Logo so it's easy to find in the block inserter. This would provide the benefits of having a dedicated "block" for the Site Logo, but it would be powered by the Image block. 🤔

Sam-Xronn commented 3 weeks ago

Backward compatibility might be a nightmare, but we could then introduce an Image block variation called Site Logo so it's easy to find in the block inserter.

This was a concern of mine, how possible the removal of a core block would be. Not sure if you could tie into the JSON versioning.

I'm still confused what a "Use site logo" option would change? As far as I'm aware the site logo doesn't change anything apart from offer an optional link to site homepage link which you can apply on an image. Or the ability to use as the site icon which should is now controlled in Settings > General.

To avoid hijacking this thread further I wonder if we could have a wider discussion on this topic in its own issue?

richtabor commented 3 weeks ago

Fair points. I wonder if extending the Image block to include a few new controls, like "Use as site logo" and deprecating the Site Logo block, would be a possible approach. Backward compatibility might be a nightmare, but we could then introduce an Image block variation called Site Logo so it's easy to find in the block inserter. This would provide the benefits of having a dedicated "block" for the Site Logo, but it would be powered by the Image block.

As I mentioned https://github.com/WordPress/gutenberg/issues/63954#issuecomment-2253163170, sure we can configure an image block to be the logo, home url, etc, but it will always be more complicated than the Site Logo block, which you can add with one click, with much more limited control than an image block. But if a user wants to use an image block for a site logo, that's also just as fine—accepting the limitations of that route all the same.

But let's keep this issue focused on the aspect ratio control being applied to the Site Logo block.