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

Add collapsible prop to AccordionSection #2107

Merged
merged 2 commits into from
Nov 9, 2023
Merged

Conversation

nishasy
Copy link
Contributor

@nishasy nishasy commented Nov 8, 2023

Summary

In the event that an accordion section needs to stay open at all times, the user can now use collapsible={false} to keep it open. This also sets the header button's aria-disabled to true, as outlined in the accessibility guidelines.

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

Test plan

yarn jest packages/wonder-blocks-accordion/src/components/__tests__/accordion-section.test.tsx
yarn jest packages/wonder-blocks-accordion/src/components/__tests__/accordion-section-header.test.tsx

Storybook

@nishasy nishasy self-assigned this Nov 8, 2023
Copy link

changeset-bot bot commented Nov 8, 2023

🦋 Changeset detected

Latest commit: fc71e25

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-accordion Minor

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

@nishasy nishasy changed the title todo Add collapsible prop to AccordionSection Nov 8, 2023
Copy link
Contributor

github-actions bot commented Nov 8, 2023

Size Change: +99 B (0%)

Total Size: 92.3 kB

Filename Size Change
packages/wonder-blocks-accordion/dist/es/index.js 3.19 kB +99 B (+3%)
ℹ️ View Unchanged
Filename Size
packages/wonder-blocks-banner/dist/es/index.js 1.53 kB
packages/wonder-blocks-birthday-picker/dist/es/index.js 1.69 kB
packages/wonder-blocks-breadcrumbs/dist/es/index.js 1.13 kB
packages/wonder-blocks-button/dist/es/index.js 4.32 kB
packages/wonder-blocks-cell/dist/es/index.js 2.19 kB
packages/wonder-blocks-clickable/dist/es/index.js 3.21 kB
packages/wonder-blocks-color/dist/es/index.js 1.15 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-dropdown/dist/es/index.js 12 kB
packages/wonder-blocks-form/dist/es/index.js 5.42 kB
packages/wonder-blocks-grid/dist/es/index.js 1.36 kB
packages/wonder-blocks-i18n/dist/es/index.js 4.54 kB
packages/wonder-blocks-icon-button/dist/es/index.js 3.06 kB
packages/wonder-blocks-icon/dist/es/index.js 3.04 kB
packages/wonder-blocks-labeled-field/dist/es/index.js 72 B
packages/wonder-blocks-layout/dist/es/index.js 1.88 kB
packages/wonder-blocks-link/dist/es/index.js 2.54 kB
packages/wonder-blocks-modal/dist/es/index.js 5.04 kB
packages/wonder-blocks-pill/dist/es/index.js 1.03 kB
packages/wonder-blocks-popover/dist/es/index.js 4.33 kB
packages/wonder-blocks-progress-spinner/dist/es/index.js 1.51 kB
packages/wonder-blocks-search-field/dist/es/index.js 1.53 kB
packages/wonder-blocks-spacing/dist/es/index.js 158 B
packages/wonder-blocks-switch/dist/es/index.js 2.06 kB
packages/wonder-blocks-testing/dist/es/index.js 3.94 kB
packages/wonder-blocks-theming/dist/es/index.js 1.21 kB
packages/wonder-blocks-timing/dist/es/index.js 1.78 kB
packages/wonder-blocks-toolbar/dist/es/index.js 862 B
packages/wonder-blocks-tooltip/dist/es/index.js 5.05 kB
packages/wonder-blocks-typography/dist/es/index.js 1.49 kB

compressed-size-action

Copy link

codecov bot commented Nov 8, 2023

Codecov Report

Merging #2107 (fc71e25) into main (d73f698) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2107   +/-   ##
=======================================
  Coverage   97.05%   97.05%           
=======================================
  Files         243      243           
  Lines       28055    28076   +21     
  Branches     2447     2373   -74     
=======================================
+ Hits        27228    27249   +21     
  Misses        827      827           
Files Coverage Δ
...ordion/src/components/accordion-section-header.tsx 100.00% <100.00%> (ø)
...cks-accordion/src/components/accordion-section.tsx 100.00% <100.00%> (ø)

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 d73f698...fc71e25. Read the comment docs.

Copy link
Contributor

github-actions bot commented Nov 9, 2023

A new build was pushed to Chromatic! 🚀

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

Chromatic results:

Metric Total
Captured snapshots 14
Tests with visual changes 0
Total stories 392
Inherited (not captured) snapshots [TurboSnap] 306
Tests on the build 320

@nishasy nishasy requested review from jandrade and a team November 9, 2023 00:04
@nishasy nishasy marked this pull request as ready for review November 9, 2023 00:04
@khan-actions-bot
Copy link
Contributor

Gerald

Required Reviewers
  • @Khan/wonder-blocks for changes to .changeset/many-kids-raise.md, __docs__/wonder-blocks-accordion/accordion-section.argtypes.tsx, __docs__/wonder-blocks-accordion/accordion-section.stories.tsx, __docs__/wonder-blocks-accordion/accordion.stories.tsx, packages/wonder-blocks-accordion/src/components/accordion-section-header.tsx, packages/wonder-blocks-accordion/src/components/accordion-section.tsx, packages/wonder-blocks-accordion/src/components/__tests__/accordion-section-header.test.tsx, packages/wonder-blocks-accordion/src/components/__tests__/accordion-section.test.tsx, packages/wonder-blocks-accordion/src/components/__tests__/accordion.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 Nov 9, 2023

npm Snapshot: Published

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

Packages can also be installed manually by running:

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

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 great! :shipit:

@@ -20,6 +20,9 @@ type Props = {
caretPosition: "start" | "end";
// Corner roundedness type.
cornerKind: AccordionCornerKindType;
// Whether the section is collapsible or not. If false, the header will
// not be clickable.
Copy link
Member

Choose a reason for hiding this comment

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

suggestion: maybe it would be good to include that the contents are visible/expanded all the time?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I didn't include that here since the content panel is not part of the header. I'll still add it now though.

@@ -53,6 +53,11 @@ type Props = AriaProps & {
* value is prioritized.
*/
cornerKind?: AccordionCornerKindType;
/**
* Whether this section is collapsible. If false, the header will not be
* clickable, and the section will be stay expanded at all times.
Copy link
Member

Choose a reason for hiding this comment

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

ah you mention it here! so probably worth copy pasting this in the other file.

@nishasy nishasy merged commit 1424a2c into main Nov 9, 2023
13 checks passed
@nishasy nishasy deleted the accordion-section-disabled branch November 9, 2023 23:57
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.

3 participants