-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Rogues styles messing with my navigation styles #63345
Comments
@aaronrobertshaw @ellatrix I'm guessing this one is related to the specificity work? |
By default, browsers underline links. The text decoration underline in the example above is added by a theme, plugin, or user. To be able to help and troubleshoot this further, more information is needed. It is unclear what theme that is used for testing and what custom styles have been added. |
@carolinan I think this one doesn't relate to the navigation block, it comes from the default "core" provided theme.json (that all themes inherit) |
@carolinan There is no navigation block, it's just custom HTML + CSS. A list with links inside. This code is added by Gutenberg:
Regardless of browsers adding underline by default, I have my own CSS rule to hide the underline, but the line above has higher priority. See my screenshot above. It's really simple. |
Yes you are both right :) |
Thanks for reporting this issue @wolffe, it's greatly appreciated 👍
Yes, I believe the default element selectors for theme.json were levelled to A TL;DR on the reasoning for the change was to ensure base global styles were applied after general reset styles and still allow nesting of block style variations.
@wolffe hopefully I can shed a little extra light on the From your screenshot (thank you 🙇), your nav link selector is made up purely of elements The As the
There are some other options to Here's a codepen link that demonstrates those options which you can explore by uncommenting the styles one at a time from top to bottom and see them apply. As for a solution, we might be able to avoid the I'll explore that today and update again when I know more. |
Quick update: It does appear to be possible to isolate the "top-level" element styles and prevent them being wrapped in The approach still needs to be replicated on the JS side for the editors and tested against global block type element styles, block style variations, etc. I hope to have a PR published later this afternoon or tomorrow morning. |
I have a PR up that addresses this issue. I'm not sure whether this will make it into WP 6.6.0 but at the very least it should be in the first point release. |
Thanks, @aaronrobertshaw. I don't want to modify my layout as it's pretty specific - I wish Gutenberg would not try to impose opinionated styles on us. Things used to work perfectly fine before, but I have 400 websites that are in danger of being broken when WordPress 6.6 comes out. Is there a way to opt out of these styles? Some filter or action or theme support I can disable? |
I appreciate your patience on this one @wolffe, thank you 👍 The fix has landed and will be available in Gutenberg 18.9. It will also be included in the first WordPress point release, 6.6.1.
FWIW the temporary workaround I was suggesting was to leverage an existing class name you might have already within your layout. Another option could be to tweak your selector to |
Okay, the I will never have a Nevertheless, thanks for the fix! I appreciate it. |
The |
I know what it does, but it shouldn't be there. It assumes ALL links that are This assumption should not be made by the core. In fact, no classes should be added by the core, except very specific ones, not umbrella ones. |
Thanks for the candid feedback @wolffe, I appreciate it 👍
The fix for this issue managed to make the Gutenberg 18.8 release which happened a few hours ago. If you're using Gutenberg, updating to 18.8 should allow you to avoid the use of |
Hi, we are currently facing the same problems as @wolffe we are mostly using the Divi Theme. As i already read that the issue is fixed in release 6.6.1. I just want to ask when this release is expected to be available. In the meantime we are just using a fix. |
Hello, similar to both @wolffe and @Uncreative-Dev, I am encountering the exact same problem of underlining on all my clients' websites created with Divi. No issues with Elementor based websites! When will the 6.6.1 version be available as many of my clients have contacted me regarding this problem. Thank you for the update. Sorry for my english, but I am Franch ;-) |
This reply in another thread goes into some ways, though it could use some more comments: #53468 (comment) |
This worked for us (using DIVI theme):
|
@fgbarrios Thanks! I will try it and see what works and what doesn't. I still want to keep the core ones, columns, buttons, covers, groups and so on. |
The filter below fixed the entire issue for me:
|
This also effects the body padding, say you have a fixed header and applied a padding-top:150px to simply body {} then the new root style specifics will overide the padding to, easy fix to update in your theme but not good for existing sites |
I also have lots of other issues, but I don't think it's worth opening new tickets. For example, All centered images got a I had to force |
Thanks for the screenshot @wolffe, it definitely helps 👍 The style with Looking through the history of the Image block's styles, the The other styles in the screenshot appear to make sense but unfortunately it doesn't show every matched style so it's hard to tell if a different style setting If this is still an issue, perhaps you could filter the styles in dev tools by |
Something has changed lately, and it changed alignment for all my images. I patch all these issues by adding counter-measures - CSS rules that target those elements and are being loaded after WordPress' inline styles. I don't think it's worth reporting them, as they keep getting added. Is there a way to stop this "specificity" project from going ahead? This is just a buzzword that's been floating around recently, and it's not beneficial to WordPress. You can see how many sites are being broken with every WordPress update. It's like forcefully trying to squeeze a square in a circle shape. This is WordPress these days. These years... |
I'm more than happy to help identify what may have changed but as I noted in my last comment I'd need to see all the styles matching the image block rather than a subset in the screenshot provided.
That is ultimately your choice however I still recommend reporting any issues. Even if you've already addressed them, they might still help others and inform how WordPress can be improved for everyone. In that spirit, perhaps we can refocus the discussion here on any specific styles and selectors that are causing a problem 🙏 |
I agree with everything @wolffe has said. |
@aaronrobertshaw Respectfully, sometimes it does feel like reporting pretty egregious CSS changes is like yelling into the void. Here are my three biggest ones:
All three of these issues broke sites we maintain, and did so 100% unnecessarily. Only the worst one has been fixed, and there is no plan to actually deploy that fix. There have been a lot of conversations about how disruptive every major WP release is these days for theme and site developers. These issues have only been made worse over time as more styling options have been added to the editor. I am starting to get heartburn every quarter knowing that month's maintenance cycle is inevitably going to involve patching every site we manage to accommodate some kind of breaking change - often times one that is, frankly, poorly conceived and unnecessarily aggressive. |
Sorry for the slow reply @eric-michel I've been offline for a couple of weeks 🙏
I can understand the sentiment, especially in a large community-driven project. Hopefully, my lack of availability recently didn't compound that experience for you 😅
Unfortunately, I can't speak too much on the first two here. I do recall seeing work around supporting negative margins on blocks which I think required some changes for
This fix was always slated for 6.6.2 as you noted, however, there are a few factors that go into scheduling point releases and that is hard to communicate across fractured GitHub issues, PRs etc. Most of the discussion around this sort of thing occurs in the WordPress Slack channels and is a great source of information if you are looking for up-to-the-minute details on a pending point release.
100% understandable. It is an important area to improve. To this end, I do have some hope that in the not-too-distant future CSS Layers will drastically reduce a lot of this friction by isolating the different levels of styling across WordPress. |
@aaronrobertshaw no apologies necessary at all! I recognize this is largely a volunteer-led operation and never expect people to drop what they're doing to answer these threads right away. My main concern is for long-term sustainable growth of Gutenberg as a software. I was happy to see that 6.6.2 did finally release, so #63912 is now resolved. I am also excited for the eventual adoption of CSS layers, and think that will do a lot to iron out some of the minor conflicts that we run into sometimes. Having said that, the two other issues I linked will not be solved with better CSS specificity. In both cases, they are CSS rules that are unnecessarily being applied in cases where they are not needed. The first, #64276, applies The second, #60922, is a problem for similar issues, but is made even worse by the fact that it's an inline style, which means it will not be helped by CSS layers even when they are adopted. There is an extensive review process for pull requests (as there should be!). My only request is that this review process includes a question akin to: "Are the CSS changes in this PR as limited in scope as they reasonably can be?" I think any reviewer asking that question of the two issues I mentioned above would answer with a resounding "no." |
For the In particular, there were some considerations made towards trying to minimise the potential impact of the change, e.g. lowering specificity of the selector with I'd also encourage anyone with a stake in WordPress theme development to join the
Leaving aside the aspect ratio issue for a moment, regarding inline styles, I'd see part of the effort of implementing CSS layers in WordPress as working out if inline styles should/could also be migrated into a separate stylesheet and CSS layer. It's unclear at the moment how much of a difference that might make as these are styles specific to a block instance and "should" override all other theme and global styles as they are applied by the end user. I want to thank you again for the feedback. At this stage, I'd like to move any further discussion to the relevant issue so it can help inform solutions and hopefully build some momentum rather than be lost on an old closed issue. |
Thanks @aaronrobertshaw! I'll take a look at the PR and see what the discussion looked like and will respond in the other issues as you suggested. I do really appreciate your time. |
Description
I have a rogue style overriding my navigation styles, namely underlines.
I do not have an underline on my navigation bar, but a very high-specificity style is being added (see attached screenshot):
:root :where(a:where(:not(.wp-element-button)))
My only solution is to add
!important
to my own styles. Who decided that all<a>
elements that are not buttons should be underlined?!!!Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
No response
Environment info
Latest WordPress, latest Gutenberg plugin, PHP 8.3+, Apache and Nginx, Windows 10 and Windows 11.
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: