WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 2 months ago

#26350 new defect (bug)

!important audit

Reported by: azaozz Owned by:
Milestone: Future Release Priority: high
Severity: major Version: 3.8
Component: Administration Keywords: needs-testing
Focuses: ui, performance Cc:

Description

After the MP6 merge many CSS rules became "very !important". Some are so !important that overwrite other !important...

Looking at wp-admin.css: in trunk there are 65 !important compared to 22 in 3.7.

Attachments (3)

26350.diff (61.7 KB) - added by adamsilverstein 22 months ago.
remove all !important statements from css
26350.2.diff (45.1 KB) - added by adamsilverstein 17 months ago.
refresh
26350.3.diff (47.9 KB) - added by MikeHansenMe 13 months ago.

Download all attachments as: .zip

Change History (15)

#1 follow-up: @Rhomanu
3 years ago

66 in 3.8.

Agreed, it's not a good practice : Using these force the use of another !important to overwrite a rule, and then it's expanding... While it's just a simple problem of CSS declaration weight.

But it will be long to fix... I'll try a bit tonight (I must find how to contribute without blocking others' work), but there's many CSS files to check.

#2 in reply to: ↑ 1 @bassgang
3 years ago

Hi Rhomanu,

I also want to look into this but do not want to make the work twice, any proposal how to divide it, any progress at your site so far?

#3 @azaozz
3 years ago

  • Milestone changed from 3.8 to Future Release

Yeah, each use of !important spreads exponentially. Every time it needs to be overridden, new !important has to be used.

As much as I'd like to get rid of all !important for 3.8, there is simply not enough time to do it... Hoping we can do this in 3.9.

#4 @nacin
3 years ago

  • Component changed from General to Performance

#5 @nacin
3 years ago

  • Component changed from Performance to Administration
  • Focuses performance added

@adamsilverstein
22 months ago

remove all !important statements from css

#6 @adamsilverstein
22 months ago

26350.diff: Is anything really that !important? and if so, why? This patch removes all !important declaration, please restore where appropriate, with !justification.

@adamsilverstein
17 months ago

refresh

#7 @adamsilverstein
17 months ago

Refresh against trunk.

Left in one !important where the purpose was indicated in a doc block.

#8 @MikeHansenMe
13 months ago

26350.3.diff is a refresh of 26350.2.diff and includes the 17 new instances of !important that have been added in the last 4 months.

This ticket was mentioned in Slack in #design by voldemortensen. View the logs.


2 months ago

#10 @FolioVision
2 months ago

  • Keywords needs-testing added

This is great work, @MikeHansenMe and @adamsilverstein, thank you. We'd like to help with any review and revision of !important free CSS for WP Admin. We have quite a bit of experience in writing resilient !important free code for plugins. How can my team help finish this revision for core?

#11 @adamsilverstein
2 months ago

@FolioVision Thanks for your offer of help.

Essentially we need to go thru each use of !important and see how its being used, try removing it and determine any consequences, then remove any that can be and document the reason for the remaining uses.

Using svn or git blame type tools we should be able to track the commit that introduced each usage (although this may be difficult given the wholesale restructure the css has undergone in the past); alternately using inspection and code hunting we should be able to determine where the class in question is used and possibly determine why it was added. Its possible many are useful (since we strive to support older browsers), or that they are extraneous - I really don't know.

My farcical proposal was just to 'remove them all' and see what breaks but in reality we probably need to exercise more diligence. If we can't determine a purpose in each case I think we should remove them and see what breaks, however we still need to spend some time trying to determine why they were added. Where we do determine they have a purpose we should add some inline comments in the CSS to indicate why the use is required or desired.

I know this is a somewhat tedious task, however its something we really should undertake and we can take them out little by little so don't feel like you have to check them all to contribute.

Thanks again for your offer of assistance.

#12 @FolioVision
2 months ago

Hi Adam,

Why don't we try to break this task into segments as @bassgang suggested in the early days? It would be great to remove the !important tags for one section of WP Admin successfully and then move on to another section. I'm worried about the idea of doing a huge amount of work to then have it ignored and slide out of date without action (commit).

Is there a particular WP Admin section which would benefit more than others from the absence of !important tags in your opinion?

Thanks, Alec

Note: See TracTickets for help on using tickets.