Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#30878 closed defect (bug) (fixed)

WP editor and CSS classname conflict

Reported by: shazdeh's profile shazdeh Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 4.2 Priority: normal
Severity: normal Version: 4.1
Component: Media Keywords: has-patch
Focuses: Cc:

Description

When wp_editor function is used on the front end it also loads wp-includes/css/media-views.min.css file, this stylesheet adds some styles for .attachment classname and so breaks attachment pages in WordPress where .attachment is a body class. Here's an example of the issue seen on the Twenty Fifteen theme: http://grab.by/DmPC.
To replicate the issue, please edit the image.php file inside Twenty Fifteen and simply call the wp_editor function somewhere in it.
Since the .attachment classname is very common and the issue is possible to arise in many different themes, felt it's a bug in WP itself and not the theme.

Attachments (4)

30878.diff (4.9 KB) - added by valendesigns 11 years ago.
30878.1.diff (4.9 KB) - added by valendesigns 11 years ago.
30878.2.diff (5.3 KB) - added by valendesigns 11 years ago.
30878.3.diff (5.3 KB) - added by valendesigns 11 years ago.

Download all attachments as: .zip

Change History (12)

@valendesigns
11 years ago

#1 @valendesigns
11 years ago

  • Keywords has-patch added

I was able to fix this pretty easily by giving the .attachment a little more specificity.

#2 follow-up: @azaozz
11 years ago

  • Component changed from Editor to Media

Don't mind making these more specific but wondering if this may break some plugins that override some of the styling.

(There appears to be a typo in 30878.diff: .selected.attachment is not equal to .selected.media-frame .attachment)

#3 in reply to: ↑ 2 @valendesigns
11 years ago

Replying to azaozz:

(There appears to be a typo in 30878.diff: .selected.attachment is not equal to .selected.media-frame .attachment)

I've refreshed the patch, sorry about the typo.

#4 @helen
11 years ago

I'm a little surprised this is the first report of this. It may be better to prefix with the .wp-core-ui scoping class that was introduced for the same issues with the buttons CSS. Also be sure to check how any changes might affect the grid view in the media library.

#5 @SergeyBiryukov
11 years ago

  • Milestone changed from Awaiting Review to 4.2

#6 @valendesigns
11 years ago

Updating the patch now. I'll double check the grid view to make sure nothing weird is happening, as well.

#7 @valendesigns
11 years ago

I've uploaded patch 30878.3.diff that uses .wp-core-ui for scoping. The media library grid view appears unaffected by this change, as far as I can tell. Everything looks normal to me.

#8 @SergeyBiryukov
11 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 31174:

Scope attachment selectors in media views to avoid interfering with attachment pages on front-end.

props valendesigns.
fixes #30878.

Note: See TracTickets for help on using tickets.