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

Import material icons from library #11901

Open
simison opened this issue Nov 15, 2018 · 9 comments
Open

Import material icons from library #11901

simison opened this issue Nov 15, 2018 · 9 comments
Labels
[Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack [Pri] Low [Status] Needs Design [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it

Comments

@simison
Copy link
Member

simison commented Nov 15, 2018

Since we decided using Material icons on our Gutenberg blocks (Automattic/wp-calypso#28519, Automattic/wp-calypso#28500), we'll have plenty more of these coming up.

Would be great to be able to import these directly from a library instead of manually copying them over like we're doing now.

We'll need the actual SVG contents, not just image path and image copied with bundle like we do for the rest of the images:

https://github.com/Automattic/wp-calypso/blob/70d34aeda7ed952d929269bf60b9cf60e6dad5db/client/gutenberg/extensions/simple-payments/editor.js#L29-L34

Some candidate source libraries:

(via Automattic/wp-calypso#28501 (comment))

@blowery
Copy link
Contributor

blowery commented Nov 15, 2018

Ah, looks like Gutenberg has just been inlining them as needed.

It looks like Gutenberg has a custom SVG wrapper for a11y concerns. Rather than pulling into one of those third party components, which has it's own set of opinions, would it make sense to add a new icons package to Gutenberg and expose the icons that way?

@material-ui/icons returns a ReactElement with their custom wrapper
material-design-icons hasn't been updated in ... 2 years? /cc @lynnmercier

@simison
Copy link
Member Author

simison commented Nov 21, 2018

It looks like Gutenberg has a custom SVG wrapper for a11y concerns.

Yep! Gutenberg SVG primitives add these three attributes for better accessibility:

role: 'img',
'aria-hidden': 'true',
focusable: 'false',

We should try to PR these to upstream to a library we choose to use so that it benefits everyone, not just us.

Creating our own might indeed make us faster and in future allow us putting WordPress specific icons there, too.

@simison
Copy link
Member Author

simison commented Dec 18, 2018

Noting that Gutenberg's SVG wrapper is not only for a11y concerns but also to make SVGs compatible with React Native:

https://github.com/WordPress/gutenberg/blob/ec1a4cbe126d860f0feb0dda8c0c8f8c1d38419b/packages/components/src/primitives/svg/index.native.js

@simison
Copy link
Member Author

simison commented Dec 27, 2018

This came up at the Core, too: WordPress/gutenberg#9647

@simison
Copy link
Member Author

simison commented Feb 7, 2019

@scruffian scruffian transferred this issue from Automattic/wp-calypso Apr 3, 2019
@scruffian scruffian added the [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack label Apr 3, 2019
@jeherve jeherve added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] Needs Design labels Apr 4, 2019
@simison
Copy link
Member Author

simison commented Apr 8, 2019

@simison
Copy link
Member Author

simison commented Apr 8, 2019

It looks like Gutenberg has a custom SVG wrapper

Might change in future: WordPress/gutenberg#14628

@blowery
Copy link
Contributor

blowery commented Apr 11, 2019

Relevant work over in Calypso: Automattic/wp-calypso#32172

@simison
Copy link
Member Author

simison commented Jul 2, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack [Pri] Low [Status] Needs Design [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

No branches or pull requests

5 participants