Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

test(combobox): add accessibility tests #3953

Merged
merged 14 commits into from
Jan 29, 2024
Merged

test(combobox): add accessibility tests #3953

merged 14 commits into from
Jan 29, 2024

Conversation

najikahalsema
Copy link
Collaborator

@najikahalsema najikahalsema commented Jan 18, 2024

Description

I have made the executive decision that a combobox, even with a tooltip, still needs a label.

To-do:

  • Label the combobox
  • get a11y snapshot tests passing
  • A test that proves aria-activedescendent matches the id of the selected menu item when press ArrowDown from the textfield.
  • Add demo with help text.
    Will need to abstract the name attribute magic happening in the tests into a helper method at a later date. Someday... but not today.

Related issue(s)

Motivation and context

accessibility is cool :)

How has this been tested?

Unit tests!

  • Test case 1
    1. Go here
    2. Do this
  • Test case 2
    1. Go here
    2. Do this

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (minor updates related to the tooling or maintenance of the repository, does not impact compiled assets)

Checklist

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • If my change required a change to the documentation, I have updated the documentation in this pull request.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices

Best practices

This repository uses conventional commit syntax for each commit message; note that the GitHub UI does not use this by default so be cautious when accepting suggested changes. Avoid the "Update branch" button on the pull request and opt instead for rebasing your branch against main.

@najikahalsema
Copy link
Collaborator Author

why is my commit history always goofy :/

@Westbrook Westbrook force-pushed the combobox branch 2 times, most recently from 086479a to 089e7e5 Compare January 19, 2024 02:47
Copy link

github-actions bot commented Jan 19, 2024

Tachometer results

Chrome

accordion permalink

Version Bytes Avg Time vs remote vs branch
npm latest 419 kB 183.07ms - 186.24ms - unsure 🔍
-1% - +1%
-1.52ms - +2.74ms
branch 410 kB 182.63ms - 185.47ms unsure 🔍
-1% - +1%
-2.74ms - +1.52ms
-

action-bar permalink

Version Bytes Avg Time vs remote vs branch
npm latest 490 kB 96.08ms - 97.91ms - unsure 🔍
-1% - +1%
-1.09ms - +1.21ms
branch 481 kB 96.25ms - 97.62ms unsure 🔍
-1% - +1%
-1.21ms - +1.09ms
-

action-button permalink

Version Bytes Avg Time vs remote vs branch
npm latest 519 kB 121.44ms - 123.86ms - unsure 🔍
-2% - +1%
-2.72ms - +1.52ms
branch 510 kB 121.51ms - 125.00ms unsure 🔍
-1% - +2%
-1.52ms - +2.72ms
-

action-group permalink

Version Bytes Avg Time vs remote vs branch
npm latest 540 kB 76.41ms - 78.06ms - unsure 🔍
-1% - +2%
-0.99ms - +1.47ms
branch 531 kB 76.08ms - 77.91ms unsure 🔍
-2% - +1%
-1.47ms - +0.99ms
-

action-menu permalink

Version Bytes Avg Time vs remote vs branch
npm latest 650 kB 195.46ms - 199.29ms - unsure 🔍
-3% - +1%
-6.04ms - +1.41ms
branch 643 kB 196.49ms - 202.89ms unsure 🔍
-1% - +3%
-1.41ms - +6.04ms
-

alert-dialog permalink

Version Bytes Avg Time vs remote vs branch
npm latest 460 kB 134.01ms - 135.66ms - unsure 🔍
-1% - +1%
-1.90ms - +0.73ms
branch 451 kB 134.39ms - 136.44ms unsure 🔍
-1% - +1%
-0.73ms - +1.90ms
-

asset permalink

Version Bytes Avg Time vs remote vs branch
npm latest 363 kB 13.88ms - 14.25ms - unsure 🔍
-1% - +2%
-0.15ms - +0.32ms
branch 354 kB 13.84ms - 14.12ms unsure 🔍
-2% - +1%
-0.32ms - +0.15ms
-

avatar permalink

Version Bytes Avg Time vs remote vs branch
npm latest 401 kB 28.06ms - 29.86ms - unsure 🔍
-5% - +4%
-1.32ms - +1.13ms
branch 393 kB 28.23ms - 29.88ms unsure 🔍
-4% - +5%
-1.13ms - +1.32ms
-

badge permalink

Version Bytes Avg Time vs remote vs branch
npm latest 402 kB 37.50ms - 38.40ms - unsure 🔍
-2% - +3%
-0.65ms - +1.00ms
branch 393 kB 37.08ms - 38.46ms unsure 🔍
-3% - +2%
-1.00ms - +0.65ms
-

button-group permalink

Version Bytes Avg Time vs remote vs branch
npm latest 447 kB 70.57ms - 72.17ms - unsure 🔍
-1% - +2%
-0.51ms - +1.69ms
branch 438 kB 70.02ms - 71.54ms unsure 🔍
-2% - +1%
-1.69ms - +0.51ms
-

button permalink

Version Bytes Avg Time vs remote vs branch
npm latest 453 kB 86.78ms - 88.46ms - unsure 🔍
-2% - +1%
-1.74ms - +0.58ms
branch 444 kB 87.40ms - 88.99ms unsure 🔍
-1% - +2%
-0.58ms - +1.74ms
-

card permalink

Version Bytes Avg Time vs remote vs branch
npm latest 510 kB 69.17ms - 70.47ms - unsure 🔍
-3% - +1%
-1.86ms - +0.67ms
branch 501 kB 69.32ms - 71.50ms unsure 🔍
-1% - +3%
-0.67ms - +1.86ms
-

checkbox permalink

Version Bytes Avg Time vs remote vs branch
npm latest 422 kB 104.15ms - 106.18ms - unsure 🔍
-1% - +1%
-1.56ms - +0.89ms
branch 413 kB 104.81ms - 106.20ms unsure 🔍
-1% - +1%
-0.89ms - +1.56ms
-

coachmark permalink

Version Bytes Avg Time vs remote vs branch
npm latest 365 kB 32.60ms - 33.24ms - unsure 🔍
-1% - +2%
-0.24ms - +0.62ms
branch 356 kB 32.45ms - 33.02ms unsure 🔍
-2% - +1%
-0.62ms - +0.24ms
-

color-area permalink

Version Bytes Avg Time vs remote vs branch
npm latest 459 kB 155.38ms - 156.91ms - unsure 🔍
-2% - +0%
-2.84ms - +0.53ms
branch 450 kB 155.79ms - 158.80ms unsure 🔍
-0% - +2%
-0.53ms - +2.84ms
-

color-handle permalink

Version Bytes Avg Time vs remote vs branch
npm latest 376 kB 50.91ms - 51.53ms - unsure 🔍
-0% - +2%
-0.09ms - +0.82ms
branch 368 kB 50.53ms - 51.19ms unsure 🔍
-2% - +0%
-0.82ms - +0.09ms
-

color-loupe permalink

Version Bytes Avg Time vs remote vs branch
npm latest 368 kB 33.65ms - 34.14ms - unsure 🔍
-4% - +1%
-1.48ms - +0.28ms
branch 359 kB 33.65ms - 35.34ms unsure 🔍
-1% - +4%
-0.28ms - +1.48ms
-

color-slider permalink

Version Bytes Avg Time vs remote vs branch
npm latest 461 kB 131.16ms - 132.77ms - unsure 🔍
-1% - +1%
-0.92ms - +1.46ms
branch 452 kB 130.82ms - 132.57ms unsure 🔍
-1% - +1%
-1.46ms - +0.92ms
-

color-wheel permalink

Version Bytes Avg Time vs remote vs branch
npm latest 463 kB 130.77ms - 132.04ms - unsure 🔍
-0% - +1%
-0.65ms - +1.19ms
branch 453 kB 130.47ms - 131.80ms unsure 🔍
-1% - +0%
-1.19ms - +0.65ms
-
Firefox

accordion permalink

Version Bytes Avg Time vs remote vs branch
npm latest 419 kB 293.92ms - 302.24ms - unsure 🔍
-3% - +2%
-8.86ms - +7.46ms
branch 410 kB 291.76ms - 305.80ms unsure 🔍
-3% - +3%
-7.46ms - +8.86ms
-

action-bar permalink

Version Bytes Avg Time vs remote vs branch
npm latest 490 kB 174.24ms - 181.20ms - unsure 🔍
-1% - +4%
-1.45ms - +7.29ms
branch 481 kB 172.16ms - 177.44ms unsure 🔍
-4% - +1%
-7.29ms - +1.45ms
-

action-button permalink

Version Bytes Avg Time vs remote vs branch
npm latest 519 kB 260.89ms - 270.51ms - unsure 🔍
-1% - +3%
-3.57ms - +9.17ms
branch 510 kB 258.72ms - 267.08ms unsure 🔍
-3% - +1%
-9.17ms - +3.57ms
-

action-group permalink

Version Bytes Avg Time vs remote vs branch
npm latest 540 kB 176.83ms - 183.09ms - unsure 🔍
-2% - +3%
-3.61ms - +5.13ms
branch 531 kB 176.16ms - 182.24ms unsure 🔍
-3% - +2%
-5.13ms - +3.61ms
-

action-menu permalink

Version Bytes Avg Time vs remote vs branch
npm latest 650 kB 327.55ms - 339.13ms - unsure 🔍
-1% - +3%
-4.11ms - +9.63ms
branch 643 kB 326.88ms - 334.28ms unsure 🔍
-3% - +1%
-9.63ms - +4.11ms
-

alert-dialog permalink

Version Bytes Avg Time vs remote vs branch
npm latest 460 kB 224.90ms - 229.54ms - unsure 🔍
-2% - +2%
-3.71ms - +4.15ms
branch 451 kB 223.83ms - 230.17ms unsure 🔍
-2% - +2%
-4.15ms - +3.71ms
-

asset permalink

Version Bytes Avg Time vs remote vs branch
npm latest 363 kB 26.89ms - 28.55ms - unsure 🔍
-5% - +4%
-1.43ms - +1.15ms
branch 354 kB 26.88ms - 28.84ms unsure 🔍
-4% - +5%
-1.15ms - +1.43ms
-

avatar permalink

Version Bytes Avg Time vs remote vs branch
npm latest 401 kB 57.42ms - 60.82ms - unsure 🔍
-4% - +3%
-2.23ms - +1.87ms
branch 393 kB 58.14ms - 60.46ms unsure 🔍
-3% - +4%
-1.87ms - +2.23ms
-

badge permalink

Version Bytes Avg Time vs remote vs branch
npm latest 402 kB 80.90ms - 86.50ms - unsure 🔍
-5% - +4%
-4.08ms - +3.68ms
branch 393 kB 81.21ms - 86.59ms unsure 🔍
-4% - +5%
-3.68ms - +4.08ms
-

button-group permalink

Version Bytes Avg Time vs remote vs branch
npm latest 447 kB 165.54ms - 173.94ms - unsure 🔍
-4% - +3%
-7.22ms - +4.42ms
branch 438 kB 167.11ms - 175.17ms unsure 🔍
-3% - +4%
-4.42ms - +7.22ms
-

button permalink

Version Bytes Avg Time vs remote vs branch
npm latest 453 kB 177.16ms - 183.92ms - unsure 🔍
-3% - +2%
-5.94ms - +4.22ms
branch 444 kB 177.61ms - 185.19ms unsure 🔍
-2% - +3%
-4.22ms - +5.94ms
-

card permalink

Version Bytes Avg Time vs remote vs branch
npm latest 510 kB 123.14ms - 128.90ms - unsure 🔍
-5% - +1%
-6.51ms - +1.59ms
branch 501 kB 125.64ms - 131.32ms unsure 🔍
-1% - +5%
-1.59ms - +6.51ms
-

checkbox permalink

Version Bytes Avg Time vs remote vs branch
npm latest 422 kB 197.99ms - 205.01ms - unsure 🔍
-2% - +3%
-4.07ms - +5.19ms
branch 413 kB 197.92ms - 203.96ms unsure 🔍
-3% - +2%
-5.19ms - +4.07ms
-

coachmark permalink

Version Bytes Avg Time vs remote vs branch
npm latest 365 kB 43.36ms - 46.08ms - unsure 🔍
-5% - +5%
-2.11ms - +2.15ms
branch 356 kB 43.06ms - 46.34ms unsure 🔍
-5% - +5%
-2.15ms - +2.11ms
-

color-area permalink

Version Bytes Avg Time vs remote vs branch
npm latest 459 kB 234.92ms - 242.40ms - unsure 🔍
-1% - +3%
-3.09ms - +5.97ms
branch 450 kB 234.66ms - 239.78ms unsure 🔍
-2% - +1%
-5.97ms - +3.09ms
-

color-handle permalink

Version Bytes Avg Time vs remote vs branch
npm latest 376 kB 91.05ms - 97.47ms - unsure 🔍
-5% - +5%
-4.33ms - +4.53ms
branch 368 kB 91.11ms - 97.21ms unsure 🔍
-5% - +5%
-4.53ms - +4.33ms
-

color-loupe permalink

Version Bytes Avg Time vs remote vs branch
npm latest 368 kB 62.28ms - 66.44ms - unsure 🔍
-5% - +5%
-3.47ms - +3.03ms
branch 359 kB 62.08ms - 67.08ms unsure 🔍
-5% - +5%
-3.03ms - +3.47ms
-

color-slider permalink

Version Bytes Avg Time vs remote vs branch
npm latest 461 kB 225.05ms - 233.27ms - unsure 🔍
-3% - +2%
-8.10ms - +4.66ms
branch 452 kB 226.00ms - 235.76ms unsure 🔍
-2% - +4%
-4.66ms - +8.10ms
-

color-wheel permalink

Version Bytes Avg Time vs remote vs branch
npm latest 463 kB 210.51ms - 216.01ms - unsure 🔍
-2% - +2%
-5.29ms - +4.05ms
branch 453 kB 210.11ms - 217.65ms unsure 🔍
-2% - +2%
-4.05ms - +5.29ms
-

@najikahalsema najikahalsema changed the title Combobox a11y test(combobox): add accessibility tests Jan 19, 2024
@najikahalsema najikahalsema marked this pull request as ready for review January 19, 2024 23:49
Copy link
Contributor

@Westbrook Westbrook left a comment

Choose a reason for hiding this comment

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

This is reviewing the code. I'll need to manual confirm the accessibility, probably in the morning.

maxlength=${ifDefined(
this.maxlength > -1 ? this.maxlength : undefined
)}
minlength=${ifDefined(
this.minlength > -1 ? this.minlength : undefined
)}
pattern=${ifDefined(this.pattern)}
placeholder=${ifDefined(this.placeholder)}
Copy link
Contributor

Choose a reason for hiding this comment

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

Did we intend to remove this here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh, yeah, I did. There's no placeholder text for the combobox. We didn't even have this.placeholder defined, iirc

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought this would apply here, but maybe not. As much a design and accessibility speak against placeholder content, many consumers want control over it, so we likely should include it when possible.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The point I'm trying to make is that a combobox doesn't have placeholder content to begin with. It's not part of the design spec or the WAI ARIA spec...

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah yes, placeholder is a part of the underlying <input type="text"> https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/placeholder, for good or ill people like to use it...

packages/combobox/stories/combobox.stories.ts Outdated Show resolved Hide resolved
/AppleWebKit/.test(window.navigator.userAgent) &&
!/Chrome/.test(window.navigator.userAgent);

const comboboxFixture = async (): Promise<TestableCombobox> => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is one of the storybook stories sufficient to test against so that we don't need another instance of this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I liked that the test fixture only had 4 options, but I guess we could configure the stories to accept the options as an argument in the stories and just feed that into the test. Idk.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we make the story template take options as an argument?

This also links up with #3953 (comment) and can be addressed later, though we should keep notes on any tasks of which we allow a deferral.

packages/combobox/test/combobox-a11y.test.ts Outdated Show resolved Hide resolved
packages/combobox/test/combobox-a11y.test.ts Outdated Show resolved Hide resolved
packages/combobox/test/combobox-a11y.test.ts Outdated Show resolved Hide resolved
packages/combobox/test/combobox-a11y.test.ts Show resolved Hide resolved
packages/combobox/test/combobox-a11y.test.ts Outdated Show resolved Hide resolved
@@ -14,11 +14,11 @@ import '@spectrum-web-components/combobox/sp-combobox.js';
import '@spectrum-web-components/menu/sp-menu-item.js';
import { html } from '@spectrum-web-components/base';
import { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';
import { comboboxOptions } from '../index.js';
import { benchmarkOptions } from '../index.js';
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

changed this var name because it felt too generic.

@najikahalsema najikahalsema merged commit 620d32f into combobox Jan 29, 2024
45 checks passed
@najikahalsema najikahalsema deleted the combobox-a11y branch January 29, 2024 20:38
Westbrook pushed a commit that referenced this pull request Jan 31, 2024
* chore: add labels to combobox input

* chore: get tests passing

* test(combobox): get a11y tests passing

* chore: remove unused positionlistbox method

* test: get tests passing, change spelling of activeDescendant

* chore: missed some descendents

* chore: add help text demo and test

* ci: update hash

* chore: address review comments

* chore: abstract shared data to index files

* test(combobox): update tests and stories to use legible data

* ci: update hash

* chore: label menu and rename stories

* ci: update hash

---------

Co-authored-by: Najika Yoo <naj.halsema@gmail.com>
Westbrook pushed a commit that referenced this pull request Feb 2, 2024
* feat(combobox): begin working branch for combobox additions

* feat(combobox): add size attribute (#3887)

* feat(combobox): wip

* chore: update sizes and stories

* chore: add isoverlayopen decorator to stories

---------

Co-authored-by: Westbrook Johnson <westbrook.johnson@gmail.com>
Co-authored-by: Najika Yoo <naj.halsema@gmail.com>

* chore: add benchmark test for lightdom combobox (#3898)

* chore: add benchmark test for lightdom combobox

* chore: add object version of benchmark test

* chore: rename files

---------

Co-authored-by: Najika Yoo <naj.halsema@gmail.com>

* test(combobox): update data management tests for current API

* test(combobox): get more tests passing and skip tests that will be visited in future work (#3919)

* test(combobox): get more tests passing and skip tests that will be visited in future work

* ci: update golden images cache

* test(combobox): ignore Combobox Item code

* chore(combobox): cleanup unused code (#3922)

* chore(combobox): cleanup unused code

* ci: update golden images cache

* fix(combobox): add support for external tooltip elements (#3930)

* fix(combobox): add support for external tooltip elements

* chore(combobox): remove unused code paths

* ci: update golden images cache

* docs(combobox): include slot present in API docs

* fix(combobox): allow intern Menu to hold a selection when autocomplete === "none" (#3951)

* test(combobox): add accessibility tests (#3953)

* chore: add labels to combobox input

* chore: get tests passing

* test(combobox): get a11y tests passing

* chore: remove unused positionlistbox method

* test: get tests passing, change spelling of activeDescendant

* chore: missed some descendents

* chore: add help text demo and test

* ci: update hash

* chore: address review comments

* chore: abstract shared data to index files

* test(combobox): update tests and stories to use legible data

* ci: update hash

* chore: label menu and rename stories

* ci: update hash

---------

Co-authored-by: Najika Yoo <naj.halsema@gmail.com>

* test(combobox): fulfil accessibility contract (#3974)

* chore: add tooltip to ariadescribedby

* test(combobox): add a11y test for tooltip

---------

Co-authored-by: Najika Yoo <naj.halsema@gmail.com>

* chore(bundle): include combobox

* chore(combobox): clean up property availability and types

* chore(combobox): clean up property availability and type

* refactor(combobox): update ComboboxOption type

* ci: update golden images cache

* refactor(combobox): simplify typing and correct query location when moving items into viewport

* docs: use human useful content in stories

* ci: update golden images cache

* refactor(combobox): default "autocomplete" to "none"

* docs: correct story configuration

* docs(combobox): create initial documentation

* docs(combobox): apply docs feedback

* docs(combobox): use only working examples in live mode

* fix(combobox): maintain focus on input element when toggling menu

* docs(combobox): improve clarity

* ci: update golden images cache

* docs(combobox): add story demonstrating controlled-component usage (#3988)

* docs(combobox): add story demonstrating controlled-component usage

* Update packages/combobox/stories/combobox.stories.ts

Co-authored-by: Westbrook Johnson <wesjohns@adobe.com>

---------

Co-authored-by: Westbrook Johnson <wesjohns@adobe.com>

* fix(combobox): add support for "readonly" and "disabled"

* docs(textfield): expand on attribute/property descriptions

* fix(combobox): add support for "readonly" and "disabled"

* ci: update golden images cache

* fix(textfield): prevent outline on :focus-visible elements that are disabled

* fix(combobox): correct value to itemText interchange when something is "selected" (#3994)

---------

Co-authored-by: Najika Halsema Yoo <44980010+najikahalsema@users.noreply.github.com>
Co-authored-by: Najika Yoo <naj.halsema@gmail.com>
Co-authored-by: Hunter Loftis <hunter@hunterloftis.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants