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

Audit use of !important #25

Open
iandunn opened this issue Sep 1, 2021 · 5 comments
Open

Audit use of !important #25

iandunn opened this issue Sep 1, 2021 · 5 comments
Labels
Help Wanted Extra attention is needed [Type] Enhancement New feature or request

Comments

@iandunn
Copy link
Member

iandunn commented Sep 1, 2021

We have a lot of instances where !important is used, and I've already run into a case where that's causing a problem.

Most of them appear to be from 05ec95d, so those may not actually be necessary for us.

The only other I see is from 7241d17, and I'm guessing there's a good reason for it - cc @coreymckrill

@iandunn iandunn added the [Type] Enhancement New feature or request label Sep 1, 2021
@iandunn iandunn added this to the Initial Launch milestone Sep 1, 2021
iandunn added a commit that referenced this issue Sep 1, 2021
These styles are artifacts of forking BlockBase, and the use of `!important` interferes with the global header/footer.

See #6
See #25
@coreymckrill
Copy link
Contributor

coreymckrill commented Sep 6, 2021

The usages in 7241d17 are necessary to override some !important rules that are generated and output by Gutenberg (or maybe Core?) based on the contentSize and wideSize values set in theme.json.

I'm guessing the ones that came from Blockbase are there for a similar reason...

@iandunn
Copy link
Member Author

iandunn commented Sep 7, 2021

I haven't noticed any side effects from 2d83fbf, so i think in some cases the blockbase ones aren't relevant to our custom design. in general, i suspect there may be a lot of blockbase styles that go unused. IIRC Lighthouse will identify rules that aren't used on any page, so we could run that before the launch.

in some cases i've be able to override the container-{hash} styles by using a more specific selector instead of !important, or by removing layout: inherit from the block comment. not sure if that'd work w/ 7241d17 though.

@iandunn iandunn added the Help Wanted Extra attention is needed label Oct 18, 2021
@tellyworth
Copy link
Contributor

@kellychoffman @beafialho any recommendations here?

@kellychoffman
Copy link
Collaborator

Not sure the best approach here - will lean on theme devs for help with this.

@iandunn
Copy link
Member Author

iandunn commented Oct 26, 2021

Lately I've been using selectors like .query-navigation-container[class*="wp-container-"] to gain a higher specificity than Gutenberg's layout styles, and that's been working well.

That may still be a symptom of a deeper problem, though, like hardcoding styles instead of taking advantage of things Gutenberg could automatically if we knew how to leverage that.

xref #30 (comment), #30 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help Wanted Extra attention is needed [Type] Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants