Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#28893 closed defect (bug) (fixed)

No margin bottom when the post type only has a title

Reported by: markoheijnen's profile markoheijnen Owned by: helen's profile helen
Milestone: 4.0 Priority: normal
Severity: normal Version: 4.0
Component: Editor Keywords: has-patch commit
Focuses: ui Cc:

Description (last modified by markoheijnen)

I was sure this was fixed in an earlier version but I saw it again.

You can reproduce it by registrering a post type with only the title and without the editor. Add a metabox to this post type and move it towards the title. You will then see that the metabox hits the title.

Attachments (8)

28893.diff (811 bytes) - added by markoheijnen 10 years ago.
28893.2.diff (447 bytes) - added by markoheijnen 10 years ago.
28893.edit_form_after_title.png (8.4 KB) - added by SergeyBiryukov 10 years ago.
28893.3.diff (391 bytes) - added by SergeyBiryukov 10 years ago.
28893.3.after.png (12.2 KB) - added by SergeyBiryukov 10 years ago.
28893.patch (305 bytes) - added by iseulde 10 years ago.
28893.2.patch (505 bytes) - added by iseulde 10 years ago.
28893.3.patch (970 bytes) - added by iseulde 10 years ago.

Download all attachments as: .zip

Change History (27)

@markoheijnen
10 years ago

#1 @michalzuber
10 years ago

I can't reproduce it, please could you be more specific on which page or provide a screenshot?

#2 @helen
10 years ago

  • Keywords has-patch removed

.edit-form-section is used in multiple places and is meant to be a helper class, please do not remove it.

#3 follow-up: @markoheijnen
10 years ago

  • Description modified (diff)
  • Keywords has-patch added

@michalzuber: I updated the ticket.

@helen: The class can be deleted as far as core goes. We use the class multiple times but edit.css is only used for this particular case. If you have a use case that I don't know about like a plugin that uses it then please tell.

#4 in reply to: ↑ 3 @helen
10 years ago

  • Keywords has-patch removed

Replying to markoheijnen:

edit.css is only used for this particular case

I don't know what this means.

It was created specifically because we have hooks that are not metabox hooks but no good way to space them or sections within them evenly without developers having to inject CSS or, worse yet, use inline CSS. "Core must use it" is not how our CSS works now, and it is definitely not where we are going in the future - and not only that, core does use it. We are not deleting the class, period.

#5 follow-up: @markoheijnen
10 years ago

Is this tone of voice really needed? I forgot about the action edit_form_after_editor. Besides that the patch I provided is totally fine and fix the issue because wp-admin/css/edit.css is only loaded on the edit post screen which only uses .edit-form-section once.

I did added a second patch which solves the issue without breaking stuff. I do have to admin using a negative margin is ugly. Reason I did this was that otherwise you have to change to many values in the editor but I can be wrong about that.

That said I still think putting a margin-bottom on .edit-form-section is wrong to do. If this is a helper class then it should not have different behaviours depending on the context of the page. You can use the class on the edit comment page but then you don't get the margin-bottom. To me that is weird but if that is intended behaviour then that is fine to me.

#6 @helen
10 years ago

Please do not read my "tone" in written words on the internet, Marko. edit.css is not only loaded on the post edit screen. All CSS is still loaded everywhere. The class does not behave differently in different contexts.

#7 @michalzuber
10 years ago

Helen was right, she knows a lot from the codebase :)
But I also checked the source and the .edit-form-section class is used in 3 different php files.

wordpress-svn$ grep -ri 'edit-form-section' src
src/wp-admin/css/edit.css:608:.edit-form-section {
src/wp-admin/edit-form-advanced.php:493:<div id="postdivrich" class="postarea edit-form-section">
src/wp-admin/edit-form-comment.php:25:<div id="post-body-content" class="edit-form-section">
src/wp-admin/includes/media.php:2654:   <div class="wp_attachment_details edit-form-section">

#8 @SergeyBiryukov
10 years ago

  • Keywords has-patch added
  • Version changed from trunk to 3.6

Related: [23615], [23955].

28893.2.diff breaks edit_form_after_title action: if you add a text input, it's hidden behind #postdivrich.

28893.3.diff adds an empty .edit-form-section div if editor is not supported, which doesn't break anything.

#9 in reply to: ↑ 5 @SergeyBiryukov
10 years ago

Replying to markoheijnen:

You can use the class on the edit comment page but then you don't get the margin-bottom. To me that is weird but if that is intended behaviour then that is fine to me.

I could not reproduce that. As noted above, wp-admin.css includes all styles, which means edit.css is loaded on Edit Comment screen as well.

Last edited 10 years ago by SergeyBiryukov (previous) (diff)

This ticket was mentioned in IRC in #wordpress-dev by DrewAPicture. View the logs.


10 years ago

#11 @SergeyBiryukov
10 years ago

#29027 was marked as a duplicate.

#12 @helen
10 years ago

Per description on #29027, it was not dropped in the split, but rather in [29049] for editor scrolling (#28328).

#13 @grapplerulrich
10 years ago

Here is a screenshot of the issue.

http://grappler.tk/screenshots/Screenshot-20140810001.jpg

#14 @SergeyBiryukov
10 years ago

  • Keywords commit added

28893.3.diff should be good to go.

@iseulde
10 years ago

#15 @iseulde
10 years ago

Sorry, this is my fault. Here, this should fix it.

#16 @iseulde
10 years ago

Not good. Trying again.

@iseulde
10 years ago

@iseulde
10 years ago

#17 @iseulde
10 years ago

  • Component changed from Posts, Post Types to Editor
  • Version changed from 3.6 to trunk

Let's do one of the last two patches. My preference goes to the last one.

#18 @helen
10 years ago

  • Owner set to helen
  • Status changed from new to accepted

#19 @helen
10 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 29618:

Restore spacing on the edit screen when a post type supports title but not editor.

props avryl.
fixes #28893.

Note: See TracTickets for help on using tickets.