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

feat: upgrade aria-query to 5.3.0 #1241

Merged

Conversation

jlp-craigmorten
Copy link
Contributor

@jlp-craigmorten jlp-craigmorten commented Jun 25, 2023

What: Upgrade aria-query to version 5.3.0.

Why: Receive latest specification updates for role / element mappings to align with WAI ARIA 1.2.

Fixes #1100
Fixes #1150
Fixes #1201
Fixes #1234
Fixes #1239

How: Upgrading version in package.json. Updating tests to mirror changes.

Checklist:

  • Documentation added to the - N/A
    docs site
  • Tests
  • TypeScript definitions updated - N/A
  • Ready to be merged

There are a couple changes of note as a result of this upgrade, namely:

  • The menuitem element no longer has associated roles. This also removes the only example of an element with two role mappings.
  • Many elements such as p and em now have dedicated roles (paragraph and emphasis respectively) inline with HTML-ARIA / WAI-ARIA 1.2. Associated tests have been updated / modified to suit.
  • The introduction of the generic role also results in some changes. E.g. anchor tags with no href are now generic under HTML-ARIA.

There are several other role / element mapping changes as a result of this change to align with specifications.

Given the number of role additions, removals, and modifications (including changes to role and/or changes to the constraints for a particular role) this should be considered a breaking change.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jun 25, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 69d966a:

Sandbox Source
react-testing-library-examples Configuration
fail to find role code Issue #1100
react-testing-library demo Issue #1100
react-testing-library demo (forked) Issue #1201
react-testing-library demo (forked) Issue #1234
react-testing-library demo Issue #1234

@codecov
Copy link

codecov bot commented Jun 25, 2023

Codecov Report

Merging #1241 (69d966a) into alpha (452097b) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##             alpha     #1241   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           24        24           
  Lines         1038      1041    +3     
  Branches       349       349           
=========================================
+ Hits          1038      1041    +3     
Flag Coverage Δ
node-18 100.00% <100.00%> (ø)
node-20 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
src/role-helpers.js 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@MatanBobi
Copy link
Member

Hi @jlp-craigmorten!
Thanks for taking the time to create this and the corresponding fix in aria-query, this is extremely appreciated.
I'll try to look into the changes later on today, in the meantime, I pushed a change to fix the CI issues we had.

@cmorten
Copy link

cmorten commented Jun 25, 2023

Hi @jlp-craigmorten!
Thanks for taking the time to create this and the corresponding fix in aria-query, this is extremely appreciated.
I'll try to look into the changes later on today, in the meantime, I pushed a change to fix the CI issues we had.

Appreciate it - I’ve just raised #1242 r.e. the CI issue

Copy link
Member

@MatanBobi MatanBobi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks great, thanks :)
I left a few comments.

src/__tests__/role-helpers.js Show resolved Hide resolved
src/__tests__/suggestions.js Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
src/role-helpers.js Outdated Show resolved Hide resolved
eps1lon
eps1lon previously approved these changes Jun 27, 2023
Copy link
Member

@eps1lon eps1lon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. @MatanBobi good for you?

MatanBobi
MatanBobi previously approved these changes Jun 28, 2023
Copy link
Member

@MatanBobi MatanBobi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great to me. Thanks a lot for the work :)
@eps1lon do you think we should make this a breaking change?

@nickmccurdy
Copy link
Member

nickmccurdy commented Jul 12, 2023

My understanding of SemVer is that we only need to publish breaking changes in a major release if we upgrade to a version of a spec that's no longer back compatible with a version that we've documented supporting.

Here are the specification versions we link to, organized by our APIs:

API Specification
ByRole option description Accessible Name and Description Computation 1.1
ByRole API Accessible Rich Internet Applications 1.2
ByRole option description Accessible Rich Internet Applications 1.1
isInaccessible Accessible Rich Internet Applications 1.2

@MatanBobi
Copy link
Member

MatanBobi commented Jul 17, 2023

My understanding of SemVer is that we only need to publish breaking changes in a major release if we upgrade to a version of a spec that's no longer back compatible with a version that we've documented supporting.

Here are the specification versions we link to, organized by our APIs:

API Specification
ByRole option description Accessible Name and Description Computation 1.1
ByRole API Accessible Rich Internet Applications 1.2
ByRole option description Accessible Rich Internet Applications 1.1
isInaccessible Accessible Rich Internet Applications 1.2

Thanks @nickmccurdy!
Where were these documented? I'm not sure they are correct.
The thing is, we have some role definition that have changed in 1.2, so people might look for role="img" for example and not get the elements they used to get.

package.json Outdated Show resolved Hide resolved
@jlp-craigmorten jlp-craigmorten dismissed stale reviews from MatanBobi and eps1lon via 47511c6 August 9, 2023 08:30
@jlp-craigmorten
Copy link
Contributor Author

jlp-craigmorten commented Aug 9, 2023

This is now blocked behind #1242

(as is any other changes to this repo)

@MatanBobi
Copy link
Member

I agree with @timdeschryver about this being a breaking change that should cause a major version release.
If that's the path we're going with, we can merge these two together (this one and #1242) and create a major release. That way we'll be sure we're not breaking something with the op_mobile change and with this one.
What do you all think?

@timdeschryver
Copy link
Member

@MatanBobi that would mean to drop support for Node v14, right?
I like that, because also end of life.

@MatanBobi
Copy link
Member

@MatanBobi that would mean to drop support for Node v14, right?

I like that, because also end of life.

Yes, definitely. In this major we'll also drop support for node 14 with these changes.

@eps1lon do you have any concerns?

@MatanBobi
Copy link
Member

MatanBobi commented Sep 9, 2023

Hi @jlp-craigmorten :)
Since we're creating a new major version (due to the fact we're dropping support for node 14 and 16), we'll probably get this into alpha version first.
We're trying to gather a list of the changes for the change log, do you happen to know if there's a full list somewhere?

Thanks again for the effort you've put into this one!

@nickmccurdy
Copy link
Member

nickmccurdy commented Sep 10, 2023

My understanding of SemVer is that we only need to publish breaking changes in a major release if we upgrade to a version of a spec that's no longer back compatible with a version that we've documented supporting.

Here are the specification versions we link to, organized by our APIs:

API Specification
ByRole option description Accessible Name and Description Computation 1.1
ByRole API Accessible Rich Internet Applications 1.2
ByRole option description Accessible Rich Internet Applications 1.1
isInaccessible Accessible Rich Internet Applications 1.2

Thanks @nickmccurdy!
Where were these documented? I'm not sure they are correct.
The thing is, we have some role definition that have changed in 1.2, so people might look for role="img" for example and not get the elements they used to get.

I was referring to the docs, I've added links above to give more context.

That being said, it seems like we've already decided on a major version, which I support.

@nickmccurdy
Copy link
Member

nickmccurdy commented Sep 10, 2023

If you merge in from alpha CI should be fixed by #1255.

@MatanBobi
Copy link
Member

I was referring to the docs, I've added links above to give more context.

Thanks @nickmccurdy, we'll probably need to update the places where we direct to 1.1 as part of the major release :)

@jlp-craigmorten
Copy link
Contributor Author

jlp-craigmorten commented Sep 10, 2023

Hi @jlp-craigmorten :) Since we're creating a new major version (due to the fact we're dropping support for node 14 and 16), we'll probably get this into alpha version first. We're trying to gather a list of the changes for the change log, do you happen to know if there's a full list somewhere?

Thanks again for the effort you've put into this one!

Just done a scan through the aria-query changeset from 5.1.3 to 5.3.0 and believe these are the pertinent changes:

  • feat: blockquote element now has an implicit blockquote role
  • fix: input element of type checkbox with a set aria-pressed attribute no longer has an implicit button role
  • fix: summary element with aria-expanded set to false no longer has an implicit button role
  • fix: summary element with aria-expanded set to true no longer has an implicit button role
  • feat: caption element now has an implicit caption role
  • feat: code element now has an implicit code role
  • fix: th element now has implicit columnheader role regardless of scope attribute
  • fix: select element with undefined multiple attribute and a size attribute with value 1 is no longer has an implicit combobox role
  • feat: menuitem element no longer has an implicit command role
  • feat: aside element with a set aria-label attribute now has an implicit complementary role
  • feat: aside element with a set aria-labelledby attribute now has an implicit complementary role
  • feat: del element now has an implicit deletion role
  • fix: doc-backlink element now get's it's accessible name from contents
  • fix: body element no longer has an implicit document role
  • fix: html element now has an implicit document role
  • feat: em element now has an implicit emphasis role
  • feat: a element with no href attribute now has an implicit generic role
  • feat: area element with no href attribute now has an implicit generic role
  • feat: aside element with no label attribute now has an implicit generic role
  • feat: b element now has an implicit generic role
  • feat: bdo element now has an implicit generic role
  • feat: body element now has an implicit generic role
  • feat: data element now has an implicit generic role
    - feat: footer element (not scoped to the body element) now has an implicit generic role
    - feat: header element (not scoped to the body element) now has an implicit generic role
  • feat: hgroup element now has an implicit generic role
  • feat: i element now has an implicit generic role
  • feat: pre element now has an implicit generic role
  • feat: q element now has an implicit generic role
  • feat: samp element now has an implicit generic role
  • feat: section element with no label attribute now has an implicit generic role
  • feat: small element now has an implicit generic role
  • feat: span element now has an implicit generic role
  • feat: u element now has an implicit generic role
  • feat: address element now has an implicit group role
  • feat: ins element now has an implicit insertion role
  • fix: a element now requires a set href attribute to have an implicit link role
  • fix: area element now requires a set href attribute to have an implicit link role
  • fix: link element with an href attribute no longer has an implicit link role
  • fix: select element no longer requires a set multiple attribute to have an implicit listbox role if it has a size attribute with value greater than 1
  • feat: mark element now has an implicit mark role
  • feat: menuitem element no longer has an implicit menuitem role
  • feat: meter element now has an implicit meter role
  • feat: p element now has an implicit paragraph role
  • fix: img element with an empty alt attribute now has an implicit presentation role
  • fix: frame element no longer has an implicit region role
  • fix: rel element no longer has an implicit roletype role
  • feat: strong element now has an implicit strong role
  • feat: sub element now has an implicit subscript role
  • feat: sup element now has an implicit superscript role
  • feat: time element now has an implicit time role

Feel free to condense / summarise as feel is best!


There is one other file change in this PR in addition to the changeset from upgrade aria-query which is a fix, but afaik is somewhat an implementation detail to enable a couple of the above points, namely the likes of "fix: img element with an empty alt attribute now has an implicit presentation role", so probably not needing it's own point.


For the footer and header element roles, the "scoped to body element" constraint isn't honoured by dom-testing-library, so may be confusing to include in the description... not sure off top of my head whether this lib would say the implicit role is generic or banner (for header elements) / contentinfo (for footer elements)

Update: so for the header element it is banner (and there was a test already demonstrating this), and for the footer it is contentinfo (and have just pushed a commit to eliminate this ambiguity). Might be worth not including the generic role points for these elements as that isn't something this lib supports.

@nickmccurdy

This comment was marked as resolved.

@cmorten

This comment was marked as resolved.

@MatanBobi
Copy link
Member

Since we're following the spec with this one, I think it's safe to at least merge to alpha so I'm merging this one :)

@MatanBobi MatanBobi merged commit 2c57055 into testing-library:alpha Sep 14, 2023
6 checks passed
eps1lon added a commit to eps1lon/dom-testing-library that referenced this pull request Oct 3, 2023
* feat: upgrade aria-query to 5.3.0

* fix: correctly handle img with empty alt

* feat: pin `aria-query` version

* chore: add accessibility-alt-text-bot (testing-library#1240)

* chore: add accessibility-alt-text-bot

* fix formatting issues

* test: add coverage for footer to confirm it's expected implicit role as contentinfo

---------

Co-authored-by: Sebastian Silbermann <silbermann.sebastian@gmail.com>
Co-authored-by: Matan Borenkraout <Matanbobi@gmail.com>
@eps1lon eps1lon mentioned this pull request Oct 3, 2023
@jlp-craigmorten jlp-craigmorten deleted the feat/update-aria-query-5.3.0 branch November 11, 2023 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants