You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When passing the titleProp option, the @svgr/babel-plugin-svg-dynamic-title plugin puts a <title>{title}</title> element inside the svg element. If there is an existing title element inside the svg, it will be replaced with this element only.
My question is: Is there any specific reason for falling back to the content of the existing title element (if present) when the title prop passed to the component is undefined ?
For example, suppose my test.svg has following content:
<svg>
<title>Default Title</title>
</svg>
When passing this svg through the compiler with titleProp option set to true, the content of React Component is:
<svg><title>{title}</title></svg>
Can we not keep the Default Title as fallback when title is not provided ? e.g.
I am working on an application bootstrapped with create-react-app which usage @svgr/webpack. I have also opened an issue regarding this feature in cra (facebook/create-react-app#7103).
💬 Questions and Help
When passing the
titleProp
option, the@svgr/babel-plugin-svg-dynamic-title
plugin puts a<title>{title}</title>
element inside the svg element. If there is an existing title element inside the svg, it will be replaced with this element only.My question is: Is there any specific reason for falling back to the content of the existing title element (if present) when the title prop passed to the component is undefined ?
For example, suppose my
test.svg
has following content:When passing this svg through the compiler with
titleProp
option set to true, the content of React Component is:Can we not keep the
Default Title
as fallback when title is not provided ? e.g.@neoziro Please help.
P.S.: I looked into the
babel-plugin-svg-dynamic-title/src/index.js
source code but had no clue about the implementation.The text was updated successfully, but these errors were encountered: