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

3003 autocomplete when in dialog intercepts escape keypresses and click outside #3087

Conversation

green6erry
Copy link
Contributor

@green6erry green6erry commented Mar 28, 2023

Describe your changes here.

Closes #3003

Screenshots

Please provide before/after screenshots for any visual changes
If the Dialog component includes an Autocomplete in the body, you can still close the dialog by pressing the escape key.

Merge checklist

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

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

@changeset-bot
Copy link

changeset-bot bot commented Mar 28, 2023

⚠️ No Changeset found

Latest commit: baedff0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@github-actions
Copy link
Contributor

github-actions bot commented Mar 28, 2023

size-limit report 📦

Path Size
dist/browser.esm.js 102.42 KB (+0.01% 🔺)
dist/browser.umd.js 103 KB (+0.02% 🔺)

@green6erry green6erry temporarily deployed to github-pages March 28, 2023 19:49 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3087 March 28, 2023 19:49 Inactive
@green6erry green6erry marked this pull request as ready for review April 3, 2023 15:29
@green6erry green6erry requested review from a team and joshblack April 3, 2023 15:29
@github-actions github-actions bot temporarily deployed to storybook-preview-3087 April 3, 2023 15:34 Inactive
@green6erry green6erry temporarily deployed to github-pages April 3, 2023 15:36 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3087 April 3, 2023 15:36 Inactive
@green6erry green6erry force-pushed the 3003-autocomplete-when-in-dialog-intercepts-escape-keypresses-and-click-outside branch from 4be31e9 to 7e4ae8f Compare April 24, 2023 22:34
@green6erry green6erry temporarily deployed to github-pages April 25, 2023 16:51 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3087 April 25, 2023 16:51 Inactive
@green6erry green6erry temporarily deployed to github-pages April 25, 2023 17:15 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3087 April 25, 2023 17:15 Inactive
@green6erry green6erry temporarily deployed to github-pages May 2, 2023 21:35 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3087 May 2, 2023 21:36 Inactive
@green6erry green6erry temporarily deployed to github-pages May 2, 2023 22:08 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3087 May 2, 2023 22:08 Inactive
@joshblack joshblack removed their request for review May 17, 2023 19:41
src/stories/Autocomplete.stories.tsx Outdated Show resolved Hide resolved
src/stories/Dialog.stories.tsx Outdated Show resolved Hide resolved
src/Flash/__tests__/__snapshots__/Flash.test.tsx.snap Outdated Show resolved Hide resolved
@lesliecdubs
Copy link
Member

@green6erry bump on this one for when you're back in office. Let's work on getting this closed out please!

@green6erry green6erry added the skip changeset This change does not need a changelog label Jul 3, 2023
@siddharthkp siddharthkp removed their request for review July 4, 2023 14:09
@siddharthkp
Copy link
Member

siddharthkp commented Jul 4, 2023

@green6erry Unsubscribing from changes, feel free to re-request review when you're ready :)

@green6erry green6erry temporarily deployed to github-pages July 5, 2023 18:27 — with GitHub Actions Inactive
@mperrotti mperrotti temporarily deployed to github-pages July 7, 2023 20:24 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3087 July 7, 2023 20:24 Inactive
@mperrotti mperrotti temporarily deployed to github-pages July 7, 2023 21:39 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3087 July 7, 2023 21:40 Inactive
@green6erry green6erry temporarily deployed to github-pages July 12, 2023 16:27 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3087 July 12, 2023 16:27 Inactive
Copy link
Member

@siddharthkp siddharthkp left a comment

Choose a reason for hiding this comment

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

I think this is great work.

  1. Found a potential accessibility concern.

  2. question (not blocker for this PR, something to consider after): What is the difference between Dialog/useDialog and Overlay/useOverlay? Should Dialog use Overlay underneath to get focus + keyboard features?

) : (
// HACK: This ensures AutocompleteMenu is still mounted when closing the menu and all of the hooks inside of it are still called.
// A better way to do this would be to move the hooks to AutocompleteOverlay or somewhere that won't get unmounted.
<VisuallyHidden>{children}</VisuallyHidden>
Copy link
Member

Choose a reason for hiding this comment

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

Comparing the a11y tree both production and this branch, in production (left) the listbox is not in the a11y tree until the autocomplete is opened. While, in this branch, it's in the a11y tree even when the autocomplete is closed.

because Overlay uses the css property visibility, it removes the contents from the accessibility tree, which VisuallyHidden does not.

in production (left) the listbox is not in the a11y tree until the autocomplete is opened. While, in this branch, it's in the a11y tree even when the autocomplete is closed

If we can rid of the hack, that would of course be perfect. But, if not, we probably would need to make it aria-hidden as well.

src/hooks/useDialog.ts Show resolved Hide resolved
…n-in-dialog-intercepts-escape-keypresses-and-click-outside
@green6erry green6erry temporarily deployed to github-pages July 17, 2023 17:16 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3087 July 17, 2023 17:16 Inactive
@green6erry green6erry temporarily deployed to github-pages July 17, 2023 19:58 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3087 July 17, 2023 19:59 Inactive
@green6erry green6erry temporarily deployed to github-pages July 19, 2023 19:48 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3087 July 19, 2023 19:49 Inactive
@green6erry green6erry temporarily deployed to github-pages July 20, 2023 14:10 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3087 July 20, 2023 14:11 Inactive
Copy link
Member

@siddharthkp siddharthkp left a comment

Choose a reason for hiding this comment

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

The dom tree looks good now!

@green6erry green6erry added this pull request to the merge queue Jul 24, 2023
Merged via the queue into main with commit c736e8e Jul 24, 2023
30 checks passed
@green6erry green6erry deleted the 3003-autocomplete-when-in-dialog-intercepts-escape-keypresses-and-click-outside branch July 24, 2023 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip changeset This change does not need a changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AutoComplete, when in dialog, intercepts escape keypresses and click outside
4 participants