Skip to content

Commit d9f1249

Browse files
committed
Menus: Remove floats from custom links section in the Nav Menus screen.
With the new admin design, there were some issues with floating elements in the custom links section of the classic Menu screen. This changeset simplifies the CSS implementation by removing floats and `wp-clearfix` classes from some elements in favor of a more robust implementation based on flex positionning. Props audrasjb, huzaifaalmesbah, shailu25, nikunj8866, joedolson, khushi1501, ozgursar. Fixes #64692. See #64308. git-svn-id: https://develop.svn.wordpress.org/trunk@62097 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 30eb659 commit d9f1249

2 files changed

Lines changed: 14 additions & 13 deletions

File tree

src/wp-admin/css/nav-menus.css

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -375,17 +375,11 @@ input.bulk-select-switcher:focus + .bulk-select-button-label {
375375
}
376376

377377
/* Add Menu Item Boxes */
378-
.postbox .howto input,
379-
.customlinkdiv .menu-item-textbox,
380-
.customlinkdiv .error-message {
378+
.postbox .howto input {
381379
width: 180px;
382380
float: right;
383381
}
384382

385-
.customlinkdiv .error-message {
386-
clear: right;
387-
}
388-
389383
.accordion-container .outer-border {
390384
margin: 0;
391385
}
@@ -477,7 +471,10 @@ input.bulk-select-switcher:focus + .bulk-select-button-label {
477471
width: 180px;
478472
}
479473

480-
.customlinkdiv label,
474+
.customlinkdiv .menu-item-textbox {
475+
width: 100%;
476+
}
477+
481478
.nav-menus-php .howto span {
482479
float: left;
483480
margin-top: 6px;
@@ -876,6 +873,10 @@ body.menu-max-depth-11 { min-width: 1280px !important; }
876873
justify-content: space-between;
877874
}
878875

876+
.button-controls-customlinkdiv {
877+
justify-content: flex-end;
878+
}
879+
879880
/* =Media Queries
880881
-------------------------------------------------------------- */
881882

src/wp-admin/includes/nav-menu.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ function wp_nav_menu_item_link_meta_box() {
363363
<div class="customlinkdiv" id="customlinkdiv">
364364
<input type="hidden" value="custom" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-type]" />
365365
<p id="menu-item-url-wrap" class="wp-clearfix">
366-
<label class="howto" for="custom-menu-item-url"><?php _e( 'URL' ); ?></label>
366+
<label for="custom-menu-item-url"><?php _e( 'URL' ); ?></label>
367367
<input id="custom-menu-item-url" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-url]"
368368
type="text"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?>
369369
class="code menu-item-textbox form-required" placeholder="https://"
@@ -372,14 +372,14 @@ class="code menu-item-textbox form-required" placeholder="https://"
372372
</p>
373373

374374
<p id="menu-item-name-wrap" class="wp-clearfix">
375-
<label class="howto" for="custom-menu-item-name"><?php _e( 'Link Text' ); ?></label>
375+
<label for="custom-menu-item-name"><?php _e( 'Link Text' ); ?></label>
376376
<input id="custom-menu-item-name" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-title]"
377377
type="text"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?>
378378
class="regular-text menu-item-textbox"
379379
/>
380380
</p>
381381

382-
<p class="button-controls wp-clearfix">
382+
<p class="button-controls button-controls-customlinkdiv">
383383
<span class="add-to-menu">
384384
<input id="submit-customlinkdiv" name="add-custom-menu-item"
385385
type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?>
@@ -820,7 +820,7 @@ class="categorychecklist form-no-clear"
820820
<?php endif; ?>
821821
</div><!-- /.tabs-panel -->
822822

823-
<p class="button-controls wp-clearfix" data-items-type="<?php echo esc_attr( "posttype-{$post_type_name}" ); ?>">
823+
<p class="button-controls" data-items-type="<?php echo esc_attr( "posttype-{$post_type_name}" ); ?>">
824824
<span class="list-controls hide-if-no-js">
825825
<input type="checkbox"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?>
826826
id="<?php echo esc_attr( $tab_name ); ?>" class="select-all"
@@ -1115,7 +1115,7 @@ class="categorychecklist form-no-clear"
11151115
</ul>
11161116
</div><!-- /.tabs-panel -->
11171117

1118-
<p class="button-controls wp-clearfix" data-items-type="<?php echo esc_attr( "taxonomy-{$taxonomy_name}" ); ?>">
1118+
<p class="button-controls" data-items-type="<?php echo esc_attr( "taxonomy-{$taxonomy_name}" ); ?>">
11191119
<span class="list-controls hide-if-no-js">
11201120
<input type="checkbox"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?>
11211121
id="<?php echo esc_attr( $tab_name ); ?>" class="select-all"

0 commit comments

Comments
 (0)