<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>245299</bug_id>
          
          <creation_ts>2022-09-16 14:02:48 -0700</creation_ts>
          <short_desc>Set empty string for reflection of IDREF attributes</short_desc>
          <delta_ts>2022-10-07 06:56:32 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Accessibility</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>245301</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Ryosuke Niwa">rniwa</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>andresg_22</cc>
    
    <cc>rego</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1899073</commentid>
    <comment_count>0</comment_count>
      <attachid>462404</attachid>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2022-09-16 14:02:48 -0700</bug_when>
    <thetext>Created attachment 462404
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(&apos;aria-activedescendant&apos;) should return null.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1899074</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-09-16 14:03:05 -0700</bug_when>
    <thetext>&lt;rdar://problem/100042078&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1899076</commentid>
    <comment_count>2</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2022-09-16 14:04:09 -0700</bug_when>
    <thetext>Expected:
In the attached test case, we should see:
[object HTMLDivElement]
bar
null
null

Actual:
[object HTMLDivElement]
bar
null
bar</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1900048</commentid>
    <comment_count>3</comment_count>
    <who name="Manuel Rego Casasnovas">rego</who>
    <bug_when>2022-09-21 00:20:44 -0700</bug_when>
    <thetext>There&apos;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:
&quot;
  1. If element&apos;s explicitly set attr-element is not null:

     * If element&apos;s explicitly set attr-element is a descendant of any of element&apos;s shadow-including ancestors, then return element&apos;s explicitly set attr-element.

     * Otherwise, return null.
&quot;

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?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1900320</commentid>
    <comment_count>4</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2022-09-21 23:14:32 -0700</bug_when>
    <thetext>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&apos;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&apos;s node tree whose ID is the value of that id attribute,
  then set id to the given value&apos;s ID.

4. Set the content attribute&apos;s value for this to id.

5. Set this&apos;s explicitly set attr-element to a weak reference to the given value.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1900323</commentid>
    <comment_count>5</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2022-09-21 23:26:06 -0700</bug_when>
    <thetext>Filed https://github.com/whatwg/html/issues/8306</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1903087</commentid>
    <comment_count>6</comment_count>
    <who name="Manuel Rego Casasnovas">rego</who>
    <bug_when>2022-10-04 03:53:36 -0700</bug_when>
    <thetext>(In reply to Ryosuke Niwa from comment #5)
&gt; 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&apos;t reflect the content attribute and we&apos;ll just set the empty string there.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1904035</commentid>
    <comment_count>7</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2022-10-07 06:56:28 -0700</bug_when>
    <thetext>Committed 255267@main (05f04306d2dc): &lt;https://commits.webkit.org/255267@main&gt;

Reviewed commits have been landed. Closing PR #4977 and removing active labels.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>462404</attachid>
            <date>2022-09-16 14:02:48 -0700</date>
            <delta_ts>2022-09-16 14:02:48 -0700</delta_ts>
            <desc>Test</desc>
            <filename>aria-move.html</filename>
            <type>text/html</type>
            <size>476</size>
            <attacher name="Ryosuke Niwa">rniwa</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sPgo8Ym9keT4KPGRpdiBpZD0iZm9vIj48L2Rpdj4KPGRpdiBp
ZD0iYmFyIj48L2Rpdj4KPGRpdiBpZD0iaG9zdCI+PC9kaXY+CjxzY3JpcHQ+Cgpmb28uYXJpYUFj
dGl2ZURlc2NlbmRhbnRFbGVtZW50ID0gYmFyOwpkb2N1bWVudC53cml0ZShmb28uYXJpYUFjdGl2
ZURlc2NlbmRhbnRFbGVtZW50ICsgJzxicj4nKTsKZG9jdW1lbnQud3JpdGUoZm9vLmdldEF0dHJp
YnV0ZSgnYXJpYS1hY3RpdmVkZXNjZW5kYW50JykgKyAnPGJyPicpOwpob3N0LmF0dGFjaFNoYWRv
dyh7bW9kZTogJ2Nsb3NlZCd9KS5hcHBlbmRDaGlsZChiYXIpOwpkb2N1bWVudC53cml0ZShmb28u
YXJpYUFjdGl2ZURlc2NlbmRhbnRFbGVtZW50ICsgJzxicj4nKTsKZG9jdW1lbnQud3JpdGUoZm9v
LmdldEF0dHJpYnV0ZSgnYXJpYS1hY3RpdmVkZXNjZW5kYW50JykgKyAnPGJyPicpOwoKPC9zY3Jp
cHQ+CjwvYm9keT4KPC9odG1sPgo=
</data>

          </attachment>
      

    </bug>

</bugzilla>