Gutenberg: ToggleControl visually broken when wrapped in `Disabled` component

Created on 19 Nov 2018  路  3Comments  路  Source: WordPress/gutenberg

ToggleControl is visually broken by having a thick rectangular border around it when wrapped in Disabled component.

screenshot 2018-11-19 at 10 03 32

To Reproduce

  1. Use Gutenberg 4.4.0 or current master.

  2. Create a block:

    import { registerBlockType } from '@wordpress/blocks';
    import { Disabled, ToggleControl } from '@wordpress/components';
    import { Fragment } from '@wordpress/element';
    import { InspectorControls } from '@wordpress/editor';
    
    const toggles = (
      <Fragment>
        <Disabled>
          <ToggleControl label="This is disabled" />
        </Disabled>
        <ToggleControl label="This is not disabled" />
      </Fragment>
    );
    
    registerBlockType( 'demo/toggle-control', {
      title: 'Toggle Control demo',
      category: 'layout',
      edit: () => (
        <Fragment>
          <InspectorControls>{ toggles }</InspectorControls>
          { toggles }
        </Fragment>
      ),
      save: () => null,
    } );
    
  3. Insert block in the editor
    Observe how disabled toggle has funky borders around it in both sidebar inspector as well at the block content area.

Expected behavior

鉁旓笌 No funkiness.

Desktop:

  • OS: MacOS
  • Browser Firefox
  • Version 63
[Feature] UI Components

Most helpful comment

Sure I'll take a look.

All 3 comments

This is not great, @jasmussen can you take a look when you have a minute? I'm hoping this will be some straight forward CSS <3

Sure I'll take a look.

Submitted #12091 to fix this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Pikkals picture Pikkals  路  98Comments

afercia picture afercia  路  73Comments

azaozz picture azaozz  路  91Comments

tofumatt picture tofumatt  路  86Comments

jasmussen picture jasmussen  路  74Comments