-
Notifications
You must be signed in to change notification settings - Fork 378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reference Target: How to handle invalid ID references? #1071
Comments
I think Option 1a seems like the best choice. The reference is invalid, and any JS attribute that resolves the reference target returns null to reflect that case. |
I agree that 1a is the right path here. I'd love for the browser to give me "dev time" warnings about these sorts of things, but that's an argument for a different day. Does this feel reasonable to expand the explainer/spec with? |
In agreement, 1a is correct here. I agree with @Westbrook's comment; we should add a console message warning of the invalid id. |
I think this WPT test assumes option 2: https://github.com/web-platform-tests/wpt/blob/master/shadow-dom/reference-target/tentative/dom-mutation.html Specifically, the first two cases each mutate the DOM such that the reference target is no longer valid, and the expectation is that the label match the computed text of the host. Should we update the test? |
This question was brought up by @Westbrook in #1067 (review):
It's not yet spelled out in the Reference Target Explainer. An example of this situation is when the shadow root's reference target is invalid; in this case
INVALID_ID
. What is the<input>
'saria-activedescendant
in this case?There are two options when a shadow root's
referenceTarget
refers to an invalid ID (no element with the given ID exists in the shadow tree):aria-activedescendant="fancy-listbox"
attribute is invalid, and there is no active descendant.referenceTarget
set.fancy-listbox
itself would be the active descendant.--
A related question: If we go with Option 1 (the reference target is invalid), then what does a JS attribute targeting the host element return?
E.g.:
The options here are:
1a. The attribute returns
null
because the reference is invalid and doesn't resolve to a real element.1b. The attribute returns the
<fancy-input>
like it would if the reference target were valid.The text was updated successfully, but these errors were encountered: