Menus: Improve the HTML semantics of the "Menu Settings" section.

- removes the previous markup based on a definition list
- groups checkboxes in `fieldset` elements with a `legend`
- simplifies the CSS lowering selectors specificity

Props xavortm.

Fixes #38023.


git-svn-id: https://develop.svn.wordpress.org/trunk@38912 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrea Fercia 2016-10-25 17:28:40 +00:00
parent 6d8e277152
commit 590a7de43b
2 changed files with 32 additions and 23 deletions

View File

@ -109,24 +109,28 @@ ul.add-menu-item-tabs li {
margin-top: 2em; margin-top: 2em;
} }
.menu-settings dl { .menu-settings-group {
margin: 0 0 10px; margin: 0 0 10px;
overflow: hidden; overflow: hidden;
padding-left: 18%; padding-left: 20%;
} }
.menu-settings dd { .menu-settings-group:last-of-type {
margin-bottom: 0;
}
.menu-settings-input {
float: left; float: left;
margin: 0; margin: 0;
width: 100%; width: 100%;
} }
.menu-settings dt { .menu-settings-group-name {
float: left; float: left;
clear: both; clear: both;
width: 21.951%; width: 25%;
padding: 3px 0 0; padding: 3px 0 0;
margin-left: -21.951%; margin-left: -25%; /* 20 container left padding x ( 100 container % width / 80 this % width ) */
} }
.menu-settings label { .menu-settings label {
@ -869,23 +873,26 @@ body.menu-max-depth-11 { min-width: 1280px !important; }
width: 25px; width: 25px;
} }
.menu-settings dl { .menu-settings-group {
padding-left: 0; padding-left: 0;
} }
.menu-settings dd { .menu-settings-group-name {
float: none;
width: 100%;
margin-bottom: 15px;
}
.menu-settings dt {
float: none; float: none;
width: auto; width: auto;
margin-left: 0; margin-left: 0;
margin-bottom: 15px; margin-bottom: 15px;
} }
.menu-settings-input {
float: none;
margin-bottom: 15px;
}
.menu-edit .checkbox-input {
margin-top: 0;
}
.manage-menus select { .manage-menus select {
margin: 0.5em 0; margin: 0.5em 0;
} }

View File

@ -798,17 +798,19 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
$auto_add = false; $auto_add = false;
} ?> } ?>
<dl class="auto-add-pages"> <fieldset class="menu-settings-group auto-add-pages">
<dt class="howto"><?php _e( 'Auto add pages' ); ?></dt> <legend class="menu-settings-group-name howto"><?php _e( 'Auto add pages' ); ?></legend>
<dd class="checkbox-input"><input type="checkbox"<?php checked( $auto_add ); ?> name="auto-add-pages" id="auto-add-pages" value="1" /> <label for="auto-add-pages"><?php printf( __('Automatically add new top-level pages to this menu' ), esc_url( admin_url( 'edit.php?post_type=page' ) ) ); ?></label></dd> <div class="menu-settings-input checkbox-input">
</dl> <input type="checkbox"<?php checked( $auto_add ); ?> name="auto-add-pages" id="auto-add-pages" value="1" /> <label for="auto-add-pages"><?php printf( __('Automatically add new top-level pages to this menu' ), esc_url( admin_url( 'edit.php?post_type=page' ) ) ); ?></label>
</div>
</fieldset>
<?php if ( current_theme_supports( 'menus' ) ) : ?> <?php if ( current_theme_supports( 'menus' ) ) : ?>
<dl class="menu-theme-locations"> <fieldset class="menu-settings-group menu-theme-locations">
<dt class="howto"><?php _e( 'Theme locations' ); ?></dt> <legend class="menu-settings-group-name howto"><?php _e( 'Theme locations' ); ?></legend>
<?php foreach ( $locations as $location => $description ) : ?> <?php foreach ( $locations as $location => $description ) : ?>
<dd class="checkbox-input"> <div class="menu-settings-input checkbox-input">
<input type="checkbox"<?php checked( isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] == $nav_menu_selected_id ); ?> name="menu-locations[<?php echo esc_attr( $location ); ?>]" id="locations-<?php echo esc_attr( $location ); ?>" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" /> <input type="checkbox"<?php checked( isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] == $nav_menu_selected_id ); ?> name="menu-locations[<?php echo esc_attr( $location ); ?>]" id="locations-<?php echo esc_attr( $location ); ?>" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" />
<label for="locations-<?php echo esc_attr( $location ); ?>"><?php echo $description; ?></label> <label for="locations-<?php echo esc_attr( $location ); ?>"><?php echo $description; ?></label>
<?php if ( ! empty( $menu_locations[ $location ] ) && $menu_locations[ $location ] != $nav_menu_selected_id ) : ?> <?php if ( ! empty( $menu_locations[ $location ] ) && $menu_locations[ $location ] != $nav_menu_selected_id ) : ?>
@ -819,9 +821,9 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
); );
?></span> ?></span>
<?php endif; ?> <?php endif; ?>
</dd> </div>
<?php endforeach; ?> <?php endforeach; ?>
</dl> </fieldset>
<?php endif; ?> <?php endif; ?>