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

WB-1676: Combobox - Add multiple Selection support #2223

Open
wants to merge 9 commits into
base: combobox-single
Choose a base branch
from

Conversation

jandrade
Copy link
Member

@jandrade jandrade commented May 7, 2024

Summary:

Create the multiple version that displays the selected values as individual Pill
components that can be deleted/unchecked.

Added a new hook to manage keyboard navigation for the multiple selection logic.

Combobox Implementation Plan:

  1. WB-1589: Add Listbox component with Single and Multiple selection support #2216
  2. WB-1675: Implement Combobox component with single selection #2221
  3. Add multiple selection support to Combobox component.[CURRENT]
  4. Improve accessibility support on Combobox (labels, aria-live).
  5. Add autocomplete support to Combobox component.
  6. Add async/dynamic support to Combobox component.

Issue: https://khanacademy.atlassian.net/browse/WB-1676

Test plan:

  1. Navigate to: /?path=/docs/packages-dropdown-combobox--docs#multiple%20selection
  2. Use the multi-select version of the Combobox.
  3. Navigate using the keyboard.
  4. Verify that you can select multiple options and can delete selected options using the keyboard.

Keyboard navigation instructions (when the combobox is focused):

  • Arrow Up | Arrow Down: to navigate the listbox options
  • Arrow left | Arrow right: to navigate the selected options (pills displayed before the input)
  • Backspace: removes the last pill in the stack
  • Enter:
    • When the listbox is focused: unselects an option from the list
    • When the pills are focused: removes the currently focused pill and unselects the associated option in the listbox.
Screen.Recording.2024-05-09.at.4.24.30.PM.mov

@jandrade jandrade self-assigned this May 7, 2024
Copy link

changeset-bot bot commented May 7, 2024

🦋 Changeset detected

Latest commit: 265751e

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

This PR includes changesets to release 3 packages
Name Type
@khanacademy/wonder-blocks-dropdown Minor
@khanacademy/wonder-blocks-pill Minor
@khanacademy/wonder-blocks-birthday-picker 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

Copy link
Contributor

github-actions bot commented May 7, 2024

Size Change: +985 B (+1.01%)

Total Size: 98.8 kB

Filename Size Change
packages/wonder-blocks-dropdown/dist/es/index.js 16.2 kB +983 B (+6.45%) 🔍
packages/wonder-blocks-pill/dist/es/index.js 1.65 kB +2 B (+0.12%)
ℹ️ 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.72 kB
packages/wonder-blocks-breadcrumbs/dist/es/index.js 1.13 kB
packages/wonder-blocks-button/dist/es/index.js 4.28 kB
packages/wonder-blocks-cell/dist/es/index.js 2.24 kB
packages/wonder-blocks-clickable/dist/es/index.js 3.29 kB
packages/wonder-blocks-core/dist/es/index.js 3.67 kB
packages/wonder-blocks-data/dist/es/index.js 6.33 kB
packages/wonder-blocks-form/dist/es/index.js 5.33 kB
packages/wonder-blocks-grid/dist/es/index.js 1.36 kB
packages/wonder-blocks-i18n/dist/es/index.js 4.56 kB
packages/wonder-blocks-icon-button/dist/es/index.js 3.21 kB
packages/wonder-blocks-icon/dist/es/index.js 1.06 kB
packages/wonder-blocks-labeled-field/dist/es/index.js 72 B
packages/wonder-blocks-layout/dist/es/index.js 1.89 kB
packages/wonder-blocks-link/dist/es/index.js 2.53 kB
packages/wonder-blocks-modal/dist/es/index.js 5.52 kB
packages/wonder-blocks-popover/dist/es/index.js 4.86 kB
packages/wonder-blocks-progress-spinner/dist/es/index.js 1.51 kB
packages/wonder-blocks-search-field/dist/es/index.js 1.55 kB
packages/wonder-blocks-switch/dist/es/index.js 2.1 kB
packages/wonder-blocks-testing/dist/es/index.js 3.94 kB
packages/wonder-blocks-theming/dist/es/index.js 697 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 857 B
packages/wonder-blocks-tooltip/dist/es/index.js 6.91 kB
packages/wonder-blocks-typography/dist/es/index.js 1.49 kB

compressed-size-action

Copy link
Contributor

github-actions bot commented May 7, 2024

A new build was pushed to Chromatic! 🚀

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

Chromatic results:

Metric Total
Captured snapshots 73
Tests with visual changes 5
Total stories 420
Inherited (not captured) snapshots [TurboSnap] 259
Tests on the build 332

Copy link

codecov bot commented May 7, 2024

Codecov Report

Attention: Patch coverage is 99.17582% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 95.26%. Comparing base (7554bcd) to head (265751e).

Additional details and impacted files

Impacted file tree graph

@@                 Coverage Diff                 @@
##           combobox-single    #2223      +/-   ##
===================================================
+ Coverage            94.72%   95.26%   +0.54%     
===================================================
  Files                  249      251       +2     
  Lines                29736    30046     +310     
  Branches              2447     2453       +6     
===================================================
+ Hits                 28166    28624     +458     
+ Misses                1543     1412     -131     
+ Partials                27       10      -17     
Files Coverage Δ
...own/src/components/combobox-multiple-selection.tsx 100.00% <100.00%> (ø)
...wonder-blocks-dropdown/src/components/combobox.tsx 99.60% <100.00%> (+0.85%) ⬆️
...s/wonder-blocks-dropdown/src/hooks/use-listbox.tsx 99.19% <100.00%> (+0.83%) ⬆️
...ackages/wonder-blocks-pill/src/components/pill.tsx 100.00% <100.00%> (ø)
...ocks-dropdown/src/hooks/use-multiple-selection.tsx 97.16% <97.16%> (ø)

... and 31 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 7554bcd...265751e. Read the comment docs.

@jandrade jandrade marked this pull request as ready for review May 9, 2024 20:26
@khan-actions-bot khan-actions-bot requested a review from a team May 9, 2024 20:26
@khan-actions-bot
Copy link
Contributor

Gerald

Required Reviewers
  • @Khan/wonder-blocks for changes to .changeset/giant-coats-fail.md, .changeset/mean-eagles-explode.md, __docs__/wonder-blocks-dropdown/combobox.stories.tsx, packages/wonder-blocks-dropdown/package.json, packages/wonder-blocks-dropdown/tsconfig-build.json, packages/wonder-blocks-dropdown/src/components/combobox-multiple-selection.tsx, packages/wonder-blocks-dropdown/src/components/combobox.tsx, packages/wonder-blocks-dropdown/src/hooks/use-listbox.tsx, packages/wonder-blocks-dropdown/src/hooks/use-multiple-selection.tsx, packages/wonder-blocks-pill/src/components/pill.tsx, packages/wonder-blocks-dropdown/src/components/__tests__/combobox.test.tsx

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

Copy link
Contributor

github-actions bot commented May 9, 2024

npm Snapshot: Published

🎉 Good news!! We've packaged up the latest commit from this PR (a52e000) 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="PR2223"

Packages can also be installed manually by running:

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

Copy link
Member

@jeresig jeresig left a comment

Choose a reason for hiding this comment

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

Looking good to me, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants