Skip to content

Reflection of IDREF attributes will leave stale ID value #8306

@rniwa

Description

@rniwa

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a11y-trackerGroup bringing to attention of a11y, or tracked by the a11y Group but not needing response.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions