Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Block icon on the block switcher may become unreadable. #16390

Merged
merged 1 commit into from
Jul 4, 2019

Conversation

jorgefilipecosta
Copy link
Member

Description

We were forcing a color change on the icon in cases where there were no available items on the block switcher, but we were not forcing a background color change -- this may make the icon totally invisible. If we force a color chnage we should also force a background color change.

Related: #16349

How has this been tested?

I disabled the group block on the block manager so the group transform is not available.
I pasted the following code on the browser console:

( function() {
	var registerBlockType = wp.blocks.registerBlockType;
	var el = wp.element.createElement;

	registerBlockType( 'test/block', {
		title: 'Test Block',
		icon: { background: '#555d66', foreground: "#fff", src: 'warning' },
		category: 'common',

		edit: function( props ) {
			return el( 'div', { style: { outline: '1px solid gray', padding: 5 } },
                el( 'span', {}, 'My test block' ),
			);
		},

		save: function( props ) {
			return el( 'div', { style: { outline: '1px solid gray', padding: 5 } },
                el( 'span', {}, 'My test block' ),x
			);
		},
	} );
} )();

I inserted the 'Test Block' block, and I verified its icon is visible.

Screenshots

Before:
Screenshot 2019-07-02 at 11 43 39

After:
Screenshot 2019-07-02 at 11 44 13

@talldan talldan added the [Type] Bug An existing feature does not function as intended label Jul 4, 2019
Copy link
Contributor

@talldan talldan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants