From 30feecbc56468a22edfe3fe4065eb78703eb95b0 Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Wed, 23 Oct 2019 15:49:16 +1100 Subject: [PATCH] Fix label/input styling. --- .../src/navigation-menu-item/edit.js | 19 ++++------ .../src/navigation-menu-item/editor.scss | 38 +++---------------- 2 files changed, 13 insertions(+), 44 deletions(-) diff --git a/packages/block-library/src/navigation-menu-item/edit.js b/packages/block-library/src/navigation-menu-item/edit.js index fd8dcb1f8690d..8b04a19133234 100644 --- a/packages/block-library/src/navigation-menu-item/edit.js +++ b/packages/block-library/src/navigation-menu-item/edit.js @@ -35,7 +35,6 @@ import { BlockControls, InnerBlocks, InspectorControls, - PlainText, URLPopover, } from '@wordpress/block-editor'; import { @@ -84,16 +83,14 @@ function NavigationMenuItemEdit( { let content; if ( isSelected ) { content = ( -
- setAttributes( { label: labelValue } ) } - aria-label={ __( 'Navigation Label' ) } - maxRows={ 1 } - /> - </div> + <TextControl + ref={ plainTextRef } + className="wp-block-navigation-menu-item__field" + value={ label } + onChange={ ( labelValue ) => setAttributes( { label: labelValue } ) } + label={ __( 'Navigation Label' ) } + hideLabelFromVision={ true } + /> ); } else { content = <div className="wp-block-navigation-menu-item__container"> diff --git a/packages/block-library/src/navigation-menu-item/editor.scss b/packages/block-library/src/navigation-menu-item/editor.scss index 2ce6d0a1993a1..fa52d09acf41e 100644 --- a/packages/block-library/src/navigation-menu-item/editor.scss +++ b/packages/block-library/src/navigation-menu-item/editor.scss @@ -1,43 +1,15 @@ -$menu-label-field-width: 140px; - -.wp-block-navigation-menu-item__edit-container { - display: grid; - grid-auto-columns: min-content; - grid-auto-flow: column; - align-items: center; - white-space: nowrap; - border: 1px solid $light-gray-500; - // two pixes comes from two times one pixel border - width: $menu-label-field-width + $icon-button-size + 2px; - padding-left: 1px; -} - -.wp-block-navigation-menu-item__edit-container .wp-block-navigation-menu-item__field { - border-right: 1px solid $light-gray-500 !important; - width: $menu-label-field-width; - border: none; +// Specificity override for .edit-post-visual-editor input[type="text"] +.wp-block-navigation-menu-item__field .components-text-control__input.components-text-control__input { border-radius: 0; - padding-left: $grid-size-large; - - min-height: $icon-button-size - 1px; - line-height: $icon-button-size - 1px; - - &, - &:focus { - color: $dark-gray-500; - } + background-color: transparent; + padding: $block-padding; } +.wp-block-navigation-menu-item__field .components-text-control__input.components-text-control__input, .wp-block-navigation-menu-item { font-family: $editor-font; font-weight: bold; font-size: $text-editor-font-size; - - .wp-block-navigation-menu-item__container, - &.is-editing .editor-plain-text { - background-color: var(--background-color-menu-link); - color: var(--color-menu-link); - } } .wp-block-navigation-menu-item__nofollow-external-link {