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

Visibility issues for some icons #51

Open
2 tasks done
bobbingwide opened this issue Nov 18, 2021 · 4 comments
Open
2 tasks done

Visibility issues for some icons #51

bobbingwide opened this issue Nov 18, 2021 · 4 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@bobbingwide
Copy link
Owner

bobbingwide commented Nov 18, 2021

Problems with Columns variations icons

In earlier versions of Gutenberg certain icons appear differently in the editor than in the front end.
eg Columns variations.
image
In the block editor the icons are not filled with black
image

Problem with Comment Author Name icon

With Gutenberg 11.9.0 the icon for the new Comment Author Name block is visible in the block icon block in the editor but not in other blocks nor on the front end.

The SVG for the Comment Author Name block is

<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="#FFFFFF" role="img" aria-hidden="true" focusable="false"><path d="M18 4H6c-1.1 0-2 .9-2 2v12.9c0 .6.5 1.1 1.1 1.1.3 0 .5-.1.8-.3L8.5 17H18c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 11c0 .3-.2.5-.5.5H7.9l-2.4 2.4V6c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v9z" fill-rule="evenodd" clip-rule="evenodd"></path><path d="M15 15V15C15 13.8954 14.1046 13 13 13L11 13C9.89543 13 9 13.8954 9 15V15" fill-rule="evenodd" clip-rule="evenodd"></path><circle cx="12" cy="9" r="2" fill-rule="evenodd" clip-rule="evenodd"></circle></svg>

Here we see the fill='#FFFFFF' attribute on the SVG tag. For the block info block the icon is invisible.

Using the inspector and changing this value to #CCCCCC, for example, allows us to see the icon in the block editor.
Alternatively we can set a background colour.
image

This problem was originally mentioned in #50 (comment)

Requirement

  • Icons should look the same in the editor and the front end

Proposed solution

  • Discover what's needed to style icons that have the following attributes that need a little more care and attention: fill, fill-rule, cllp-rule etc
  • Implement appropriate CSS
@bobbingwide bobbingwide added bug Something isn't working help wanted Extra attention is needed labels Nov 18, 2021
@bobbingwide bobbingwide self-assigned this Nov 18, 2021
@bobbingwide
Copy link
Owner Author

bobbingwide commented Nov 18, 2021

Discover what's needed to style icons that have the following attributes that need a little more care and attention: fill, fill-rule, cllp-rule etc

Adding the fill: currentColor; property to the style.scss files which are procesed into style-index.css half fixed the problem.
eg This was the CSS for the block list block.

.wp-block-oik-block-blocklist svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

But...

  1. This CSS didn't get loaded for the blocklist block if the blockicon block wasn't also used on the page.
  2. The Comment Author Avatar is also wrong.

It would appear that Gutenberg 11.9.0 now enqueues the CSS for each block, not the plugin as a whole.

@bobbingwide
Copy link
Owner Author

The changes for this issue were committed in d69b5c9 and abfdcc3
oik-blocks v1.3.0 is being alpha tested on blocks.wp-a2z.org

@bobbingwide
Copy link
Owner Author

Other people were having problems with a number of icons.
See WordPress/gutenberg#36564
It looks like I'll need to revisit these icons in bobbingwide/txt2md#7 as well.

@bobbingwide
Copy link
Owner Author

See also bobbingwide/oik-bob-bing-wide#46 (comment) where icons weren't visible.
For one icon, it was the fill-rule: evenOdd property that prevented the icon from being visible on a white background.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant