Bug 244972 - Integrate ARIA element reflection in the Accessibility Tree
Summary: Integrate ARIA element reflection in the Accessibility Tree
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Manuel Rego Casasnovas
URL:
Keywords: InRadar
Depends on: 245762
Blocks: 196843 245301
  Show dependency treegraph
 
Reported: 2022-09-09 06:34 PDT by Manuel Rego Casasnovas
Modified: 2022-09-28 22:05 PDT (History)
5 users (show)

See Also:


Attachments
Patch (35.05 KB, patch)
2022-09-20 22:08 PDT, Manuel Rego Casasnovas
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Manuel Rego Casasnovas 2022-09-09 06:34:13 PDT
IDREF element reflection hasn't been hooked up with AccessibilityObject.

Right now if you do something like the following example, the a11y tree doesn't know anything about the label you're assigning to the custom input:
        <label id="anotherLabel">Another label</label>
        <x-input-idref id="myxinput"></x-input-idref>

        <script>
          class XInputIDREF extends HTMLElement {
            constructor() {
              super();
              this.attachShadow({ mode: "open" });
              let input = document.createElement("input");
              input.id = "innerbutton";
              this.shadowRoot.appendChild(input);
              input.ariaLabelledByElements = [anotherLabel];
            }
          }
          customElements.define("x-input-idref", XInputIDREF);

If you use the accessibility info in the inspector, you'll see the inner <input> doesn't have the label associated to it.
This is because as the attribute is not reflected, as the label is not in the shadow tree, and we need to update AccessibilityObject::elementsFromAttribute() to return the explicitly set elements in that scenario.
Comment 1 Radar WebKit Bug Importer 2022-09-09 06:34:40 PDT
<rdar://problem/99742765>
Comment 2 Ryosuke Niwa 2022-09-12 09:07:23 PDT
I think this is also broken when the referenced element doesn't have an ID
Comment 3 Manuel Rego Casasnovas 2022-09-12 22:40:04 PDT
Pull request: https://github.com/WebKit/WebKit/pull/4299
Comment 4 Manuel Rego Casasnovas 2022-09-20 22:08:46 PDT
Created attachment 462484 [details]
Patch
Comment 5 Manuel Rego Casasnovas 2022-09-20 22:09:14 PDT
Comment on attachment 462484 [details]
Patch

Sorry wrong command to upload patch.
Comment 6 EWS 2022-09-27 04:19:40 PDT
Committed 254905@main (5a61ea9a8257): <https://commits.webkit.org/254905@main>

Reviewed commits have been landed. Closing PR #4299 and removing active labels.
Comment 7 WebKit Commit Bot 2022-09-27 17:29:03 PDT
Re-opened since this is blocked by bug 245762
Comment 8 Manuel Rego Casasnovas 2022-09-27 22:24:47 PDT
*** Bug 245761 has been marked as a duplicate of this bug. ***
Comment 9 Manuel Rego Casasnovas 2022-09-27 23:47:25 PDT
New pull request: https://github.com/WebKit/WebKit/pull/4784
Comment 10 EWS 2022-09-28 22:05:00 PDT
Committed 254985@main (fa51d4c1048c): <https://commits.webkit.org/254985@main>

Reviewed commits have been landed. Closing PR #4784 and removing active labels.