<?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>251383</bug_id>
          
          <creation_ts>2023-01-30 12:40:40 -0800</creation_ts>
          <short_desc>Reflected ARIA properties should not treat setting undefined the same as null</short_desc>
          <delta_ts>2023-10-25 09:32:10 -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>Safari Technology Preview</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Nolan Lawson">nlawson</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>andresg_22</cc>
    
    <cc>rego</cc>
    
    <cc>rniwa</cc>
    
    <cc>tyler_w</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1929504</commentid>
    <comment_count>0</comment_count>
      <attachid>464760</attachid>
    <who name="Nolan Lawson">nlawson</who>
    <bug_when>2023-01-30 12:40:40 -0800</bug_when>
    <thetext>Created attachment 464760
Repro

Safari Technology Preview version: Release 146 (Safari 15.4, WebKit 16614.1.14.10.6)

Steps to reproduce:

1. Go to https://codepen.io/nolanlawson-the-selector/pen/OJwojEW

What is the expected result?

It should log &quot;undefined&quot; (the string).

What happens instead?

It logs null.

Here is the minimal repro (same as in the CodePen):

    const div = document.createElement(&apos;div&apos;)
    div.ariaLabel = undefined
    console.log(div.ariaLabel)

Per the ARIA spec [1], setting `null` on a reflected `aria*` property removes the associated `aria-` attribute (if it exists). However, it doesn&apos;t say anything about setting `undefined`.

So in this case, setting `undefined` should presumably be treated the same as any other non-string value – i.e. it should be stringified:

    div.ariaLabel = undefined
    div.ariaLabel // &apos;undefined&apos;
    div.getAttribute(&apos;aria-label&apos;) // &apos;undefined&apos;

Note that Chrome and Safari behave identically, and Firefox has not implemented ARIA reflection yet. More details are in the relevant ARIA bug [2].

I also filed a bug on Chromium [3].

[1]: https://w3c.github.io/aria/#enumerated-attribute-values-html
[2]: https://github.com/w3c/aria/issues/1858
[3]: https://bugs.chromium.org/p/chromium/issues/detail?id=1411465</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1929842</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-01-31 13:04:18 -0800</bug_when>
    <thetext>&lt;rdar://problem/104881298&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1987438</commentid>
    <comment_count>2</comment_count>
    <who name="Nolan Lawson">nlawson</who>
    <bug_when>2023-10-25 09:32:10 -0700</bug_when>
    <thetext>This issue can be closed per tentative resolution in https://github.com/w3c/aria/pull/2057. Once the spec is updated, WebKit&apos;s behavior will be correct per the spec.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>464760</attachid>
            <date>2023-01-30 12:40:40 -0800</date>
            <delta_ts>2023-01-30 12:40:40 -0800</delta_ts>
            <desc>Repro</desc>
            <filename>repro.html</filename>
            <type>text/html</type>
            <size>145</size>
            <attacher name="Nolan Lawson">nlawson</attacher>
            
              <data encoding="base64">PCFkb2N0eXBlIGh0bWw+CjxodG1sPgo8c2NyaXB0Pgpjb25zdCBkaXYgPSBkb2N1bWVudC5jcmVh
dGVFbGVtZW50KCdkaXYnKQpkaXYuYXJpYUxhYmVsID0gdW5kZWZpbmVkCmNvbnNvbGUubG9nKGRp
di5hcmlhTGFiZWwpCjwvc2NyaXB0Pgo8L2h0bWw+Cg==
</data>

          </attachment>
      

    </bug>

</bugzilla>