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: Correct roles and add missing attributes #1314

Closed
wants to merge 9 commits into from

Conversation

smockle
Copy link
Member

@smockle smockle commented Jun 18, 2021

Partial fix for https://github.com/github/primer/issues/217

  • <button> element (from <DropdownButton>) should have type="button"
  • <Overlay> (from <AnchoredOverlay>) should have role="dialog" or role="menu", not role="listbox"
  • <Item>s should have separate labels and descriptions

Screenshot

No visual change for <Item descriptionVariant={"inline"} />

main branch This PR
main-inline PR-inline

No visual change for <Item descriptionVariant={"block"} />

main branch This PR
main-block PR-block

Improved label for menuitem node

main branch This PR
main-AT PR-AT

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

@changeset-bot
Copy link

changeset-bot bot commented Jun 18, 2021

🦋 Changeset detected

Latest commit: 3dbb0f8

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

This PR includes changesets to release 1 package
Name Type
@primer/components 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

@vercel
Copy link

vercel bot commented Jun 18, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/primer/primer-components/5DpWPkie8fgMqAkryzEkyJDJ3Mka
✅ Preview: https://primer-components-git-overlay-accessibility-primer.vercel.app

@vercel vercel bot temporarily deployed to Preview June 18, 2021 18:50 Inactive
@vercel vercel bot temporarily deployed to Preview June 18, 2021 19:29 Inactive
@vercel vercel bot temporarily deployed to Preview June 18, 2021 19:40 Inactive
@vercel vercel bot temporarily deployed to Preview June 18, 2021 20:20 Inactive
@vercel vercel bot temporarily deployed to Preview June 18, 2021 20:24 Inactive
@vercel vercel bot temporarily deployed to Preview June 18, 2021 20:27 Inactive
@smockle smockle marked this pull request as draft June 18, 2021 20:57
@@ -7,7 +7,7 @@ export type DropdownButtonProps = ButtonProps

export const DropdownButton = React.forwardRef<HTMLElement, React.PropsWithChildren<DropdownButtonProps>>(
({children, ...props}: React.PropsWithChildren<DropdownButtonProps>, ref): JSX.Element => (
<Button ref={ref} {...props}>
<Button ref={ref} type="button" {...props}>

Choose a reason for hiding this comment

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

If this is a standard html button, we shouldn't have to define the type should we?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think an HTML button defaults to type="submit" which is for form submission, but for javascript-y behavior, we'd want to specify type="button".

@khiga8
Copy link
Contributor

khiga8 commented Jun 18, 2021

Would you mind linking the storybook or docs examples we should be examining that correspond to these changes? 😃

I am getting a little confused because we have so many dropdown type components

@dgreif
Copy link
Member

dgreif commented Jun 21, 2021

@khiga8 the docs for these components aren't currently indexed in the docs, so it's tricky to track them down on your own. Here are the two main components affected by this change:

https://primer-components-git-overlay-accessibility-primer.vercel.app/components/DropdownMenu
https://primer-components-git-overlay-accessibility-primer.vercel.app/components/ActionMenu

@smockle
Copy link
Member Author

smockle commented Jun 22, 2021

As discussed in this week’s Primer React Planning meeting, it’s likely this PR will be closed and replaced, for a couple reasons:

  1. I now have NVDA set-up, and discovered in the process that some of the VoiceOver-driven changes in this PR require additional investigation (i.e. might not be necessary).
  2. I want to decompose the problems this PR is trying to solve into several tracking issues, to make it easier to validate fixes, and so that work can proceed in parallel.

@smockle
Copy link
Member Author

smockle commented Jun 23, 2021

Superseded by #1318 and #1320

@smockle smockle closed this Jun 23, 2021
@joshblack joshblack deleted the overlay-accessibility branch January 19, 2023 16:42
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.

4 participants