Skip to content

bug: <title> tag still exists in svg icon (ionicons 6.1.0) #1168

Closed
@jonz94

Description

@jonz94

Current Behavior

It seems like ionicons version 6.1.0 published on npm still have <title> tag inside the svg icon.

Screenshots from https://www.npmjs.com/package/ionicons?activeTab=explore

Screenshot 2023-01-18 at 04 16 46

So issues described in #838 are not completely resolved.

Expected Behavior

The svg icon published on npm should not have any <title> tag by default.

Steps to Reproduce

  1. Create an Ionic Project via ionic cli
  2. Update ionicons to 6.1.0
  3. Add <ion-icon name="accessibility-outline"></ion-icon> on the page
  4. npm start
  5. Move mouse cursor on the icon, the Accessibility tooltip will show up

Screenshot 2023-01-18 at 04 46 04

Code Reproduction URL

https://github.com/jonz94/ionicons-issue-1168

Additional Information

Based on information provided #838 (comment)

Change following lines:

ionicons/scripts/build.ts

Lines 169 to 172 in 8c2a507

const optimizedCode = optimizedSvg.data.replace(
/<svg (.*?)>/,
`<svg xmlns="http://www.w3.org/2000/svg" class="ionicon" viewBox="0 0 512 512"><title>${svgData.title}</title>`,
);

into:

const optimizedCode = optimizedSvg.data.replace(
  /<svg (.*?)>/, 
  `<svg xmlns="http://www.w3.org/2000/svg" class="ionicon" viewBox="0 0 512 512">`, 
); 

should be able to resolve the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugA bug in the functionality of Ionicons

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions