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

Allow custom keyboard navigation in Popover #2269

Merged
merged 17 commits into from
Jul 17, 2024

Conversation

catandthemachines
Copy link
Member

Summary:

Updating Popover to not override custom focus behavior for content inside Popover. Also updating component to not portal Popover into DOM and instead insert it into the DOM along side the trigger. Ideally to ensure all focus functionality works without the need of FocusManager component.

Issue: LEMS-2129

Test plan:

Go to url: ?path=/story/packages-popover-popover--custom-keyboard-navigation
See that the popover functionality works while allowing the user to only use arrow key navigation for content inside.

@catandthemachines catandthemachines self-assigned this Jul 11, 2024
Copy link

changeset-bot bot commented Jul 11, 2024

🦋 Changeset detected

Latest commit: e7952cb

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

This PR includes changesets to release 1 package
Name Type
@khanacademy/wonder-blocks-popover 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

@khan-actions-bot khan-actions-bot requested a review from a team July 11, 2024 17:00
@khan-actions-bot
Copy link
Contributor

khan-actions-bot commented Jul 11, 2024

Gerald

Required Reviewers
  • @Khan/wonder-blocks for changes to .changeset/nine-keys-sing.md, __docs__/wonder-blocks-popover/popover.accessibility.mdx, __docs__/wonder-blocks-popover/popover.argtypes.tsx, __docs__/wonder-blocks-popover/popover.stories.tsx, packages/wonder-blocks-popover/src/components/popover.tsx, packages/wonder-blocks-popover/src/components/__tests__/popover.test.tsx

Don't want to be involved in this pull request? Comment #removeme and we won't notify you of further changes.

@catandthemachines catandthemachines marked this pull request as draft July 11, 2024 17:01
@catandthemachines catandthemachines changed the title Adding stories highlighting popover works with custom keyboard interactions. Allow custom keyboard navigation in Popover Jul 11, 2024
Copy link
Contributor

github-actions bot commented Jul 11, 2024

Size Change: +81 B (+0.09%)

Total Size: 94.1 kB

Filename Size Change
packages/wonder-blocks-popover/dist/es/index.js 4.79 kB +81 B (+1.72%)
ℹ️ View Unchanged
Filename Size
packages/wonder-blocks-accordion/dist/es/index.js 3.78 kB
packages/wonder-blocks-banner/dist/es/index.js 1.53 kB
packages/wonder-blocks-birthday-picker/dist/es/index.js 1.57 kB
packages/wonder-blocks-breadcrumbs/dist/es/index.js 887 B
packages/wonder-blocks-button/dist/es/index.js 4.03 kB
packages/wonder-blocks-cell/dist/es/index.js 2.01 kB
packages/wonder-blocks-clickable/dist/es/index.js 3.06 kB
packages/wonder-blocks-core/dist/es/index.js 3.45 kB
packages/wonder-blocks-data/dist/es/index.js 6.24 kB
packages/wonder-blocks-dropdown/dist/es/index.js 14.1 kB
packages/wonder-blocks-form/dist/es/index.js 5.1 kB
packages/wonder-blocks-grid/dist/es/index.js 1.36 kB
packages/wonder-blocks-i18n/dist/es/index.js 4.51 kB
packages/wonder-blocks-icon-button/dist/es/index.js 2.99 kB
packages/wonder-blocks-icon/dist/es/index.js 828 B
packages/wonder-blocks-labeled-field/dist/es/index.js 72 B
packages/wonder-blocks-layout/dist/es/index.js 1.82 kB
packages/wonder-blocks-link/dist/es/index.js 2.27 kB
packages/wonder-blocks-modal/dist/es/index.js 5.36 kB
packages/wonder-blocks-pill/dist/es/index.js 1.64 kB
packages/wonder-blocks-progress-spinner/dist/es/index.js 1.52 kB
packages/wonder-blocks-search-field/dist/es/index.js 1.3 kB
packages/wonder-blocks-switch/dist/es/index.js 1.94 kB
packages/wonder-blocks-testing-core/dist/es/index.js 3.64 kB
packages/wonder-blocks-testing/dist/es/index.js 1.13 kB
packages/wonder-blocks-theming/dist/es/index.js 693 B
packages/wonder-blocks-timing/dist/es/index.js 1.8 kB
packages/wonder-blocks-tokens/dist/es/index.js 1.74 kB
packages/wonder-blocks-toolbar/dist/es/index.js 855 B
packages/wonder-blocks-tooltip/dist/es/index.js 6.78 kB
packages/wonder-blocks-typography/dist/es/index.js 1.23 kB

compressed-size-action

Copy link
Contributor

github-actions bot commented Jul 11, 2024

npm Snapshot: Published

🎉 Good news!! We've packaged up the latest commit from this PR (ae0488f) and published all packages with changesets to npm.

You can install the packages in webapp by running:

./services/static/dev/tools/deploy_wonder_blocks.js --tag="PR2269"

Packages can also be installed manually by running:

yarn add @khanacademy/wonder-blocks-<package-name>@PR2269

Copy link

codecov bot commented Jul 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.33%. Comparing base (4bebd48) to head (5d60c0c).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2269      +/-   ##
==========================================
+ Coverage   94.30%   95.33%   +1.03%     
==========================================
  Files         251      251              
  Lines       29666    29708      +42     
  Branches     1686     1791     +105     
==========================================
+ Hits        27976    28323     +347     
+ Misses       1685     1380     -305     
  Partials        5        5              
Files Coverage Δ
...s/wonder-blocks-popover/src/components/popover.tsx 100.00% <100.00%> (ø)

... and 35 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4bebd48...5d60c0c. Read the comment docs.

Copy link
Contributor

github-actions bot commented Jul 11, 2024

A new build was pushed to Chromatic! 🚀

https://5e1bf4b385e3fb0020b7073c-nawdojkwry.chromatic.com/

Chromatic results:

Metric Total
Captured snapshots 7
Tests with visual changes 0
Total stories 429
Inherited (not captured) snapshots [TurboSnap] 333
Tests on the build 340

@catandthemachines catandthemachines marked this pull request as ready for review July 16, 2024 16:30
Copy link
Member

@jandrade jandrade left a comment

Choose a reason for hiding this comment

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

The implementation makes sense. I'm leaving some comments for you to consider about taking a different approach in the naming for that prop. Let me know what you think.

packages/wonder-blocks-popover/src/components/popover.tsx Outdated Show resolved Hide resolved
packages/wonder-blocks-popover/src/components/popover.tsx Outdated Show resolved Hide resolved
packages/wonder-blocks-popover/src/components/popover.tsx Outdated Show resolved Hide resolved
@khan-actions-bot khan-actions-bot requested a review from a team July 17, 2024 18:13
Copy link
Member

@jandrade jandrade 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! I left you some minor comments to address before landing.

Thanks a lot for all the iterations and adding all the docs 🚀.

@@ -75,6 +75,14 @@ using:
**NOTE:** If the focus is set to the first focusable element inside the
popover, the next shift + tab will set focus on the PopoverAnchor element.

#### When `portal={false}`
Copy link
Member

Choose a reason for hiding this comment

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

praise: Love this new section, thanks!

@catandthemachines catandthemachines merged commit 47d680f into main Jul 17, 2024
15 checks passed
@catandthemachines catandthemachines deleted the catjohnson/focus-management-update branch July 17, 2024 23:05
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