Bug 245299

Summary: Set empty string for reflection of IDREF attributes
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: AccessibilityAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: andresg_22, rego, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 245301    
Attachments:
Description Flags
Test none

Ryosuke Niwa
Reported 2022-09-16 14:02:48 PDT
Created attachment 462404 [details] Test In the attached test case, we should see: [object HTMLDivElement] bar null null Instead, we see: [object HTMLDivElement] bar null null That is, when the node assigned to element.ariaActiveDescendantElement has been moved to inside a shadow tree, getAttribute('aria-activedescendant') should return null.
Attachments
Test (476 bytes, text/html)
2022-09-16 14:02 PDT, Ryosuke Niwa
no flags
Radar WebKit Bug Importer
Comment 1 2022-09-16 14:03:05 PDT
Ryosuke Niwa
Comment 2 2022-09-16 14:04:09 PDT
Expected: In the attached test case, we should see: [object HTMLDivElement] bar null null Actual: [object HTMLDivElement] bar null bar
Manuel Rego Casasnovas
Comment 3 2022-09-21 00:20:44 PDT
There's a test case in the WPT test that checks this: https://github.com/web-platform-tests/wpt/blob/master/html/dom/aria-element-reflection.html#L231 The test moves an element to the Shadow DOM then checks that ariaActiveDescendantElement is null. Checking the spec (https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#reflecting-content-attributes-in-idl-attributes) this is null because of this text: " 1. If element's explicitly set attr-element is not null: * If element's explicitly set attr-element is a descendant of any of element's shadow-including ancestors, then return element's explicitly set attr-element. * Otherwise, return null. " The first condition is not met, so it returns null. But the test case explicitly checks that the attribute is still kept with the original value. Should the fact that an element has been moved into a shadow tree has an effect on the attributes of another element? Is the test case right or wrong?
Ryosuke Niwa
Comment 4 2022-09-21 23:14:32 PDT
Hm... looks like the spec has setter steps like this. Which means that content attribute will have stale ID set. 1.If the given value is null, then: 1. Set this's explicitly set attr-element to null. 2. Remove the content attribute from this. 3. Return. 2. Let id be the empty string. 3. If the given value: * has the same root as this, and * has an id attribute, and *is the first element in this's node tree whose ID is the value of that id attribute, then set id to the given value's ID. 4. Set the content attribute's value for this to id. 5. Set this's explicitly set attr-element to a weak reference to the given value.
Ryosuke Niwa
Comment 5 2022-09-21 23:26:06 PDT
Manuel Rego Casasnovas
Comment 6 2022-10-04 03:53:36 PDT
(In reply to Ryosuke Niwa from comment #5) > Filed https://github.com/whatwg/html/issues/8306 Update bug title after the discussion on that issue. Going back to the first example, the idea is that we won't reflect the content attribute and we'll just set the empty string there.
EWS
Comment 7 2022-10-07 06:56:28 PDT
Committed 255267@main (05f04306d2dc): <https://commits.webkit.org/255267@main> Reviewed commits have been landed. Closing PR #4977 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.