-
Notifications
You must be signed in to change notification settings - Fork 357
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
Seedlet Blocks: Fix block-level global styling for site title block #4446
Seedlet Blocks: Fix block-level global styling for site title block #4446
Conversation
seedlet-blocks/assets/theme.css
Outdated
@@ -148,7 +148,7 @@ | |||
/** | |||
* Links in Content | |||
*/ | |||
.is-root-container a:not(.wp-block-button__link):not([download]), | |||
.is-root-container a:not(.wp-block-button__link):not([download]):not([aria-label="Site title text"]), |
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.
Note:
Using an aria-label attribute as an identifier seems no bueno, but I couldn't think of a better way to handle the specificity conflict. I didn't see any other obvious ways of identifying the site title a
tag.
…red values to filter through correctly.
72775c2
to
72768e1
Compare
@jeyip changes made to Blockbase themes need to happen in the .scss file (there's not much CSS that doesn't go through the scss compiler). I tinkered with this PR a big and would appreciate your eyes on it. I also found that the I also found that the site-title in the content area was being handled differently than what's in a header template part. Pay careful attention to that when taking a look at this change please. I think it's good now. I tested changing the colors of the site-title block (globally) as well as link color (globally) to make sure that it was doing what I expected it to do. |
Thank you! That makes total sense.
Taking a look now. Thanks again for the guidance here 🙏 |
I saw one potential styling issue where the hover states of links are different from the site title. It's made more apparent if we set a global link color. We remove the color css declaration in |
While testing, I also saw an issue unrelated to your changes. I noticed that the site title in the header has a hard-coded inline styled font-size, which is preventing us from modifying the block-level global styling for font size. themes/seedlet-blocks/block-template-parts/header.html Lines 6 to 8 in 1ca0423
Edit: |
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 gave this a spin and here's what I found. Caveat that I am not sure what the expected behavior should be.
@jffng From what I've seen, this brings the site title block to parity with other blocks. For example, the Post Comments Link Block and the Query Pagination Block behave similarly to what you're describing. I do agree that the behavior doesn't seem ideal though. How do you feel about moving forward with this PR to get the site title block working and I can make an issue in core Gutenberg to discuss the global styles user experience further?
Great minds think alike 🧠 I saw the same issue and mentioned the same potential solution in this comment. I'll go ahead and update the PR in a bit so that the behavior is more consistent. |
Made the changes in 257494b Lemme know what y'all think 👍 |
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.
@jeyip I appreciate you working on this! I am a bit torn about the change. This PR fixes global color customizations for all links, including the site title. So from that perspective the changes make sense.
However I don't like that we have to degrade the hover states a bit for all links. I don't think there's a way around this, since we do not yet have a way via global styles to handle hover states for buttons or links. So weighing those two things, I'm going to give a ✅ and hopefully there is a way to handle this sooner than later.
Quick follow-up to this strange behavior @jffng. I created a PR that should address this. There was a bug where, even though blocks were explicitly disabling color and background color supports, they were still being displayed in the block-level global styles UI. WordPress/gutenberg#34293 In the case of the Site Title block, text colors should be disabled. https://github.com/WordPress/gutenberg/blob/599b60d2cc8b26b9bc2141305cfe5e07b23dab88/packages/block-library/src/site-title/block.json#L20-L23 When the aforementioned bug fix is merged, text color options should no longer be displayed in the UI. |
Changes proposed in this Pull Request:
Site title block level global styling text color changes are being overridden because of a specificity conflict. To elaborate:
.wp-block-site-title a
.is-root-container a:not(.wp-block-button__link):not([download])
I'm curious how folks feel about this PR. To keep the surface area of changes small, I tried piggybacking on the
:not
pseudo-selector convention. Rather than tinkering with increasing or decreasing specificities, I include the site title block as another element not to select for the seedlet blocks selector. In doing so, the user customized global style always wins out.I didn't see any obvious visual regressions.
Before
After
Related issue(s):
#4447