Skip to content
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

Fix accessible name calculation bug related to nested <label>s #1616

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

rcj-siteimprove
Copy link
Contributor

@rcj-siteimprove rcj-siteimprove commented May 16, 2024

A variable was incorrectly being shadowed causing the state to be set incorrectly in some cases. This caused some kind of explosion in the recursion which, if there were enough <label>s inside the outer label (more than 5 I think), would lead to the maximum number of stack frames being exceeded.

In addition, if the number of inner labels was small enough, it would not crash, but the accessible name of the first <input> would be incorrect. This PR fixes that. The names of <input>s inside the inner <label>s are still computed differently than what Chrome computes. It's not completely clear yet, if Chrome is actually implementing the spec and if not, if we should follow chrome or the spec.

Example

<label>
  <input type="checkbox" name="Foo" value="Yes" />Foo
  <br />
  <label><input type="checkbox" name="Bar" value="Yes" />Bar</label>
</label>

In this example the first <input> was getting the computed name of "Foo Foo BarBar" where Chrome would get "Foo Bar". With this PR we are aligned with Chrome for that element.

I also updated some function descriptions with some examples to make it a little clearer what exactly referrer and referred means for <label> and <input>s.

To do

  • Update failing test.
  • Add test corresponding to above example.
  • Investigate what the name of inner most <input> should be.

Copy link

changeset-bot bot commented May 16, 2024

🦋 Changeset detected

Latest commit: 0bfbf86

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 77 packages
Name Type
@siteimprove/alfa-aria Patch
@siteimprove/alfa-act Patch
@siteimprove/alfa-affine Patch
@siteimprove/alfa-applicative Patch
@siteimprove/alfa-array Patch
@siteimprove/alfa-bits Patch
@siteimprove/alfa-branched Patch
@siteimprove/alfa-cache Patch
@siteimprove/alfa-callback Patch
@siteimprove/alfa-cascade Patch
@siteimprove/alfa-clone Patch
@siteimprove/alfa-collection Patch
@siteimprove/alfa-comparable Patch
@siteimprove/alfa-compatibility Patch
@siteimprove/alfa-continuation Patch
@siteimprove/alfa-css-feature Patch
@siteimprove/alfa-css Patch
@siteimprove/alfa-device Patch
@siteimprove/alfa-dom Patch
@siteimprove/alfa-earl Patch
@siteimprove/alfa-either Patch
@siteimprove/alfa-emitter Patch
@siteimprove/alfa-encoding Patch
@siteimprove/alfa-equatable Patch
@siteimprove/alfa-flags Patch
@siteimprove/alfa-fnv Patch
@siteimprove/alfa-foldable Patch
@siteimprove/alfa-functor Patch
@siteimprove/alfa-future Patch
@siteimprove/alfa-generator Patch
@siteimprove/alfa-graph Patch
@siteimprove/alfa-hash Patch
@siteimprove/alfa-http Patch
@siteimprove/alfa-iana Patch
@siteimprove/alfa-iterable Patch
@siteimprove/alfa-json-ld Patch
@siteimprove/alfa-json Patch
@siteimprove/alfa-lazy Patch
@siteimprove/alfa-list Patch
@siteimprove/alfa-map Patch
@siteimprove/alfa-mapper Patch
@siteimprove/alfa-math Patch
@siteimprove/alfa-monad Patch
@siteimprove/alfa-network Patch
@siteimprove/alfa-option Patch
@siteimprove/alfa-parser Patch
@siteimprove/alfa-performance Patch
@siteimprove/alfa-predicate Patch
@siteimprove/alfa-promise Patch
@siteimprove/alfa-record Patch
@siteimprove/alfa-rectangle Patch
@siteimprove/alfa-reducer Patch
@siteimprove/alfa-refinement Patch
@siteimprove/alfa-result Patch
@siteimprove/alfa-rules Patch
@siteimprove/alfa-sarif Patch
@siteimprove/alfa-selective Patch
@siteimprove/alfa-selector Patch
@siteimprove/alfa-sequence Patch
@siteimprove/alfa-set Patch
@siteimprove/alfa-slice Patch
@siteimprove/alfa-string Patch
@siteimprove/alfa-style Patch
@siteimprove/alfa-table Patch
@siteimprove/alfa-test Patch
@siteimprove/alfa-thenable Patch
@siteimprove/alfa-thunk Patch
@siteimprove/alfa-time Patch
@siteimprove/alfa-toolchain Patch
@siteimprove/alfa-trampoline Patch
@siteimprove/alfa-tree Patch
@siteimprove/alfa-trilean Patch
@siteimprove/alfa-tuple Patch
@siteimprove/alfa-url Patch
@siteimprove/alfa-wcag Patch
@siteimprove/alfa-web Patch
@siteimprove/alfa-xpath Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant