Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#35349 closed enhancement (fixed)

Tag meta-boxes do not offer suggestions in custom contexts

Reported by: johnjamesjacoby Owned by: boonebgorges
Priority: normal Milestone: 4.5
Component: Taxonomy Version:
Severity: normal Keywords: has-patch commit
Cc: Focuses: javascript

Description

I'm registering a custom metaboxes before and after TinyMCE like this:

add_action( 'edit_form_after_title',  'jjj_editor_above' );
add_action( 'edit_form_after_editor', 'jjj_editor_below' );

These look like:

do_meta_boxes( $GLOBALS['post_type'], 'above_editor', $GLOBALS['post'] );
do_meta_boxes( $GLOBALS['post_type'], 'below_editor', $GLOBALS['post'] );

When you drag a non-hierarchical taxonomy meta-box into one of these custom areas and reload the page, jQuery Suggest stops working. This is because:

post.js targets '#side-sortables, #normal-sortables, #advanced-sortables'

...when it could target...

.meta-box-sortables


I can fix this myself by copying that bit from post.js (see below) but, I think WordPress core can safely prevent plugins from needing to handle this on their own:

/* Custom Meta Box Locations */
$( '#above_editor-sortables, #below_editor-sortables' ).children( 'div.postbox' ).each( function() {
	if ( this.id.indexOf( 'tagsdiv-' ) === 0 ) {
		window.tagBox && window.tagBox.init();
		return false;
	}
} );

Attachments (1)

35349.1.patch (551 bytes ) - added by johnjamesjacoby 11 years ago.

Download all attachments as: .zip

Change History (5)

#1 @adamsilverstein
11 years ago

  • Keywords commit added; 2nd-opinion removed
  • Type defect (bug)enhancement

@johnjamesjacoby this looks like a reasonable enhancement; its a very small change that earns us some more flexibility with using tags on the post page. the only possible side effects i see would be unexpected application for .meta-box-sortables areas which seems unlikely.

I tested the patch and verified core tags still work as expected.

#2 @boonebgorges
11 years ago

  • Milestone Awaiting Review4.5

Looks like a good change to me.

#3 @boonebgorges
11 years ago

  • Owner set to boonebgorges
  • Resolutionfixed
  • Status newclosed

In 36227:

Use a more generous selector when setting up tag suggestion.

This allows taxonomy metaboxes to be registered in a greater variety of
locations on the Dashboard.

Props johnjamesjacoby..
Fixes #35349.

#4 @johnjamesjacoby
11 years ago

Thank you both!

Note: See TracTickets for help on using tickets.