In the following example, document.write will log "label-id" in all three cases even though the target element had moved to be inside a shadow tree:
const element = document.createElement('div');
const label = document.createElement('div');
label.id = 'label-id';
document.body.appendChild(element);
document.body.appendChild(label);
element.ariaLabelledByElements = [label];
document.write(element.getAttribute('aria-labelledby') + '<br>');
const newLabel = document.createElement('div');
newLabel.id = 'label-id'
document.body.insertBefore(newLabel, document.body.firstChild);
document.write(element.getAttribute('aria-labelledby') + '<br>');
const host = document.createElement('div');
document.body.appendChild(host);
host.attachShadow({mode: 'closed'}).appendChild(label);
document.write(element.getAttribute('aria-labelledby') + '<br>');
This doesn't seem right. It's really confusing that setting id-ref leaves id values that are stale and no longer representative of the actually referenced element.
In the following example, document.write will log "label-id" in all three cases even though the target element had moved to be inside a shadow tree:
This doesn't seem right. It's really confusing that setting id-ref leaves id values that are stale and no longer representative of the actually referenced element.