aykutkardas / react-icomoon

It makes it very simple to use SVG icons in your React and React-Native projects.
https://svgps.app
MIT License
216 stars 22 forks source link

Add support of "title" attribute #20

Closed Eugene-Musika closed 2 years ago

Eugene-Musika commented 3 years ago

It seams like title attribute do not support by browsers on <svg/> tags like they do for other tags. Example for default usage:

<span title="I'm accessible tip">Some text</span>

Example for <svg/> tag from MDN:

<svg viewBox="0 0 20 10" xmlns="http://www.w3.org/2000/svg">
  <circle cx="5" cy="5" r="4">
    <title>I'm a circle</title>
  </circle>

  <rect x="11" y="1" width="8" height="8">
    <title>I'm a square</title>
  </rect>
</svg>

It would be grate if next code

<IcoMoon iconSet={iconSet} icon="MyIcon" title="My icon" />

would transforms into

<svg ... >
  <path ... >
    <title>My icon</title>
  </path>
</svg>

cos for now if I want browser tips on icons I must make a wrapper tag with title attribute on it

aykutkardas commented 2 years ago

Good point. I plan to evaluate it and work on it soon. Thank you for your feedback.

aykutkardas commented 2 years ago

Closes https://github.com/aykutkardas/react-icomoon/commit/67a01bf03782f51c33ecc126c188e7c8c161713d

Check v2.4.0