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

fix: add keyboard handlers to sp-table-cell-head #4473

Merged
merged 5 commits into from
Jun 24, 2024
Merged

Conversation

jnurthen
Copy link
Member

@jnurthen jnurthen commented May 21, 2024

Description

Adds keyboard handlers to sp-table-cell-head

Related issue(s)

#4472

Motivation and context

Keyboard handlers needed for accessibility.

How has this been tested?

  • Test case 1
    1. Go to Storybook
    2. Tab to Column Title (sortable)
    3. Press Enter
    4. sort activates
    5. Press and release space
    6. sort activates

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.

Copy link

Branch preview

Visual regression test results

When a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:

Copy link

github-actions bot commented May 21, 2024

Lighthouse scores

Category Latest (report) Main (report) Branch (report)
Performance 0.99 0.99 0.99
Accessibility 1 1 1
Best Practices 1 1 1
SEO 1 0.92 0.92
PWA 1 1 1
What is this?

Lighthouse scores comparing the documentation site built from the PR ("Branch") to that of the production documentation site ("Latest") and the build currently on main ("Main"). Higher scores are better, but note that the SEO scores on Netlify URLs are artifically constrained to 0.92.

Transfer Size

Category Latest Main Branch
Total 222.694 kB 210.485 kB 🏆 210.904 kB
Scripts 54.665 kB 48.269 kB 🏆 48.426 kB
Stylesheet 34.987 kB 30.308 kB 🏆 30.538 kB
Document 6.026 kB 5.304 kB 5.30 kB 🏆
Font 127.016 kB 126.604 kB 🏆 126.64 kB

Request Count

Category Latest Main Branch
Total 45 45 45
Scripts 37 37 37
Stylesheet 5 5 5
Document 1 1 1
Font 2 2 2

Copy link

github-actions bot commented May 21, 2024

Tachometer results

Chrome

table permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 531 kB 122.31ms - 124.77ms - faster ✔
2% - 5%
2.08ms - 6.92ms
branch 493 kB 125.96ms - 130.13ms slower ❌
2% - 6%
2.08ms - 6.92ms
-
Firefox

table permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 531 kB 268.58ms - 277.70ms - unsure 🔍
-3% - +1%
-8.92ms - +3.96ms
branch 493 kB 271.07ms - 280.17ms unsure 🔍
-1% - +3%
-3.96ms - +8.92ms
-

Comment on lines 87 to 98
protected handleKeyup(event: KeyboardEvent): void {
const { code } = event;
switch (code) {
case 'Space':
this.removeEventListener('keyup', this.handleKeyup);
this.click();
break;
/* c8 ignore next 2 */
default:
break;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you ever get a keyup on Space that didn't previously have a keydown on Space? In that case that you can't, which is how I understand this to work, could we simplify and have keyup be the persistent listener and not require the keydown listener at all?

Copy link
Member Author

@jnurthen jnurthen May 22, 2024

Choose a reason for hiding this comment

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

honestly I copied this from swatch which was doing the same thing. Happy to simplify if that makes sense - I just assumed there was a good reason for it.

@Rajdeepc Rajdeepc requested a review from a team May 28, 2024 02:58
@Rajdeepc Rajdeepc added Component: Table a11y Issues related to accessibility labels May 28, 2024
@blunteshwar blunteshwar self-requested a review May 29, 2024 10:10
@Rajdeepc Rajdeepc requested a review from a team June 7, 2024 08:08
Copy link
Contributor

@Rajdeepc Rajdeepc left a comment

Choose a reason for hiding this comment

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

One small addition needs to go in to the definition of this class. Can you make sure it is added before we can land this!

@adobe adobe deleted a comment from blunteshwar Jun 19, 2024
Copy link
Contributor

@Rajdeepc Rajdeepc left a comment

Choose a reason for hiding this comment

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

LGTM!

@Rajdeepc Rajdeepc merged commit 794263e into main Jun 24, 2024
58 checks passed
@Rajdeepc Rajdeepc deleted the jnurthen/issue4472 branch June 24, 2024 04:00
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
a11y Issues related to accessibility Component: Table
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants