"Updated" message DIV jumping around Edit Post screen
|Reported by:||Alhadis||Owned by:|
Okay, so I'm developing a plugin that uses a separate form tag on the Edit Posts screen to manage custom attributes. This form's inserted into the header using the "in_admin_header" action.
Now, to keep the same consistent formatting, I've used the same class names as used by the headings on the rest of the page:
<div class="wrap rbs_ep"> <div class="icon32"><br /></div> <h2>Edit Properties</h2> ... </div>
Now, whenever the page is published or updated, the "Updated" message box suddenly jumps from the top of the page into the form. Looking through the source for a bit, I found the culprit:
./wp-admin/js/common.dev :: Lines 197-199
// Move .updated and .error alert boxes. Don't move boxes designed to be inline. $('div.wrap h2:first').nextAll('div.updated, div.error').addClass('below-h2'); $('div.updated, div.error').not('.below-h2, .inline').insertAfter( $('div.wrap h2:first') );
This little script is assuming that the first <h2> tag it finds is the one being displayed at the top of the page to the user. Now, I know the obvious solution here would simply be to move the form's source to the page's footer, but I still think this is a clumsy solution to an otherwise preventable issue.
Can't the Edit Page's heading be assigned an ID so the script can place the "updated" box more accurately? I don't want to duplicate CSS rules in my layout simply to reapply the same formatting using a different tag (e.g., "<div class="h2">Edit Properties</div>"), as this'd simply be a messier approach. I think the script should be looking for a H2 tag with an ID (or at least a specific CSS class) to place the message box.
Change History (4)
comment:2 @c3mdigital — 20 months ago
- Resolution set to invalid
- Status changed from new to closed