tl;dr:
- Is it valid to have two elements with the same ID attribute, as long as both are under separate shadow roots?
- Would screen readers handle aria-labelledbycorrectly in such situation?
For example, consider this custom element:
(function () {
  let template = document.createElement('template')
  template.innerHTML = `
    <svg viewBox="0 0 206 74"
         fill="none"
         xmlns="http://www.w3.org/2000/svg"
         role="img"
         aria-labelledby="logo-title">
      <title id="logo-title"><slot>Logo of Some Company.</slot></title>
      <path d="..." fill="..."/>
    </svg>
  `
  class Logo extends HTMLElement {
    constructor () {
      super()
      let shadowRoot = this.attachShadow({mode: 'open'})
      shadowRoot.appendChild(template.content.cloneNode(true))
    }
  }
  customElements.define('company-logo', Logo)
})()
Would it be valid to do:
<company-logo>
  Title One.
</company-logo>
<company-logo>
  Some other title.
</company-logo>
Would this be a valid DOM, even when both <title>'s share the same ID? Would screen readers read "Title One" for the first logo, and "Some other title" for the second logo?
 
     
     
    