Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#30035 closed defect (bug) (fixed)

Can't put buttons in the Publish meta box

Reported by: ericlewis Owned by: helen
Priority: normal Milestone: 4.1
Component: Editor Version: 4.1
Severity: normal Keywords:
Cc: Focuses: javascript, administration

Description (last modified by SergeyBiryukov)

<?php
add_action( 'post_submitbox_misc_actions', function() { ?><button type='button'>hi</button><?php } );

Clicking that button and then preview will break your stuffs.

This is because this selector is too greedy. We should remove the :button selector here.

Attachments (2)

30035.diff (578 bytes ) - added by ericlewis 12 years ago.
30035.mov (4.1 MB ) - added by ericlewis 12 years ago.

Change History (11)

@ericlewis
12 years ago

#1 @SergeyBiryukov
12 years ago

  • Component AdministrationEditor
  • Description modified (diff)
  • Milestone Awaiting Review4.1

#2 @SergeyBiryukov
12 years ago

Introduced in [7103], refactored in [11874] and [26995].

#3 @helen
12 years ago

What does "break your stuffs" entail, and is there any possibility people are relying on this currently for whatever reason? Not against removing it, just like to know the details first.

@ericlewis
12 years ago

#4 follow-up: @ericlewis
12 years ago

attachment:30035.mov shows what putting a button in the Publish meta box does.

Clicking our button adds the callback that's only intended for the submit button, so when Preview button is clicked, this callback runs unintentionally, and disables the submit buttons.

Version 0, edited 12 years ago by ericlewis (next)

#5 in reply to: ↑ 4 @adamsilverstein
12 years ago

Replying to ericlewis:

attachment:30035.mov shows what putting a button in the Publish meta box does.

Clicking our button adds the callback that's only intended only to be added when the submit button is clicked, so when Preview button is clicked, this callback runs unintentionally, and disables the submit buttons.

Makes sense; wondering why :button was used in the first place, agree seems overly aggressive!

#6 @helen
12 years ago

Still curious if anybody is weirdly relying on this, or if this was done this way for a specific reason - paging azaozz.

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


12 years ago

#8 @ericlewis
12 years ago

azaozz and I spoke about it in IRC a while ago, he agreed it was too generous of a selector and we should remove it.

#9 @helen
12 years ago

  • Owner set to helen
  • Resolutionfixed
  • Status newclosed

In 30698:

Don't over-target buttons in the publish meta box.

This selector caused breakage for any custom buttons added.

props ericlewis.
fixes #30035.

Note: See TracTickets for help on using tickets.