carbon-design-system/carbon-icons-angular

[Bug]: `title` Input adds title as last-child

sjbeatle opened this issue · 3 comments

When adding a title to the icon it is added to the end of the svg:

<svg>
  <path></path>
  <title></title>
</svg>

It should be first:

<svg>
  <title></title>
  <path></path>
</svg>

Hmm 🤔 I'm not sure we have a good way to solve this at the moment ... I believe the ordering of elements comes from @carbon/icon-helpers ... I also wasn't aware that the position of elements mattered for this case, does this cause a specific functionality or accessibility violation?

It's been a while, but I think it had mostly to do with screenreaders not reading the title unless it was first... There may've been an issue with the tooltip feature on some browsers, as well.

Mozilla states that for compatibility it should be first.

Huh 🤔 Interesting ... It should be a fairly easy fix (swap the appendChild for insertBefore in the title routine)