WordPress.org

Make WordPress Core

Opened 5 months ago

Last modified 5 months ago

#53530 new defect (bug)

Twenty Twenty One: Consider disabling darkmode in wp-admin

Reported by: Clorith Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 5.6
Component: Bundled Theme Keywords: needs-patch
Focuses: Cc:

Description

Darkmode is a front-end feature of the Twenty Twenty-One theme, which lets a user toggle their viewing preferences.

With this, some unexpected side-effects have come up within wp-admin (see for example #53525, #53429).

Would it perhaps make more sense to not load dark-mode styles and features from the theme within the constraints of wp-admin? Some quick testing shows that this is a simple implementation case, achieved by adding an is_admin() check to the Twenty_Twenty_One_Dark_Mode::switch_should_render() check, and returning false if it is an admin screen.

Although the theme was introduced with WordPress 5.6, and some of the style-bleeding was present then as well, it is more apparent with the new widget editor, where the darkmode toggle button renders in each legacy widget (which all widgets are considered when first loaded by the block editor for widgets), and it's styles can have unexpected effects on the site, depending on user settings, as seen in the previously mentioned #53429.

Adding to the 5.8 milestone for consideration, on the grounds of the block-widget editor surfacing this issue more broadly.

Change History (5)

#1 @poena
5 months ago

If I understand the referenced tickets correctly the problem is not with the darkmode code, but that the widget screen previews doesn't have a CSS class to identify it with?

Then disabling the dark mode for all editors does not seem like the best choice.

The widget screen should be fixed. The Twenty Twenty-One theme will not be the only theme to style this area.

Last edited 5 months ago by poena (previous) (diff)

#2 @Clorith
5 months ago

It's more about the inconsistency in how it is being applied, since it's bleeding into controllers as well (see #53525 where it's affecting the block inserter for example, the same affects the inserter in the customizer).

You are right that other themes may also style the editor, and that isn't a problem, the general styling works great in Twenty Twenty-One as well, it's only the dark mode here that affects too broadly because the reference element classes do not exist (and probably shouldn't exist) widely inside the admin area.

#3 @poena
5 months ago

There still needs to be a way to identify exactly which screen is the current screen.

That way should be used to either correct the problem or turn it off temporary for specific screens.

Major features should not need to be removed for the entire admin area because two screens were added without identifiers.

This ticket was mentioned in Slack in #core by jeffpaul. View the logs.


5 months ago

#5 @JeffPaul
5 months ago

  • Keywords needs-patch added
  • Milestone changed from 5.8 to Future Release

With no clearly agreed to approach here, no patch/PR, and no clear owner I'm going to punt to Future Release though hopefully this can be addressed and get into 5.8.1 or 5.9.

Note: See TracTickets for help on using tickets.