fix(#3625): Accordion Refinements#3766
Conversation
25f7b18 to
acd6c01
Compare
| background-color: var(--goa-accordion-color-bg-heading-hover); | ||
| border: var(--goa-accordion-border-hover, var(--goa-accordion-border)); | ||
| color: var(--goa-accordion-color-heading-hover); | ||
| transition: var(--goa-motion-duration-medium-1) background-color |
There was a problem hiding this comment.
Lets use --goa-motionDuration-short-2 to align more closely with the "short-2" we are using for other similar elements.
7415d38 to
6134646
Compare
6134646 to
aab8bdc
Compare
✅ Deploy Preview for benji-docs-previews ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
5c66489 to
6053134
Compare
bdfranck
left a comment
There was a problem hiding this comment.
I tested the changes in the latest browsers...
Safari (Latest)
- ✅ The sizes look good
- ✅ The animation works as expected
Chrome (Latest)
- ✅ The sizes look good
- ✅ The animation works as expected
Chrome (Latest)
- ✅ The sizes look good
- ✅ The animation works as expected
Looks good! I left a couple minor comments.
| background-color: var(--goa-accordion-color-bg-heading-hover); | ||
| border: var(--goa-accordion-border-hover, var(--goa-accordion-border)); | ||
| color: var(--goa-accordion-color-heading-hover); | ||
| transition: var(--goa-motion-duration-short-2) background-color |
There was a problem hiding this comment.
Add the transition to the base summary selector on line 338 so the transitions both works on hover and blur.
| } | ||
|
|
||
| .heading { | ||
| .heading-small { |
There was a problem hiding this comment.
🤔 Hmm, you're right! I must not have included the borders in my calculations.
There was a problem hiding this comment.
@bdfranck I was able to fix this, you just need to get the latest of design-tokens first.
| } | ||
|
|
||
| .heading-medium { | ||
| line-height: 2rem; |
| event.stopPropagation(); | ||
| } | ||
|
|
||
| function onAccordionToggle(target: EventHandler) { |
There was a problem hiding this comment.
When I slowed down the animation in the Chrome Dev Tools Animation panel, I noticed that it wasn't including the component's bottom border. Is there an easy way to address this? 🤔
There was a problem hiding this comment.
@bdfranck 🤔 🤔 🤔 I believe this is a consequence of animating it using height attributes..? Do you have a suggestion? Maybe if I animate the height of an internal div instead? I can try that and see what I can do...
There was a problem hiding this comment.
After team discussion, we'll leave this animation as is.
ad8c172 to
37d01c3
Compare
|
Addressed feedback:
@bdfranck @vanessatran-ddi ready for a re-review! 🙏 |
40fb671 to
f8344c0
Compare
bdfranck
left a comment
There was a problem hiding this comment.
I looked at the latest changes with the tokens from GovAlta/design-tokens#145...
- ✅ The small heading height is
48pxand the medium heading height is64px - ✅ I see
aria-expandedistruewhen the accordion is open - ✅ The animation works as expected
Looks good to me! 👍
f8344c0 to
29e71af
Compare
1486140 to
3aa2673
Compare
|
Finished addressing comments:
Thanks again for the thoughtful feedback @vanessatran-ddi . |
35ea306 to
f06e851
Compare
|
@ArakTaiRoth This is ready to merge! 🙏 |
| // If the animation is cancelled, isClosing variable is set to false | ||
| _animation.oncancel = () => (_isClosing = false); | ||
|
|
||
| open = "false"; |
There was a problem hiding this comment.
Because we're setting open to false here, before onAnimationFinish actually finishes. This causes the content to disappear before the Accordion actually closes.
There was a problem hiding this comment.
@ArakTaiRoth Good catch, I wasn't looking close enough at the animation afterwards!
This is now fixed. I didn't see any issues or regressions.
f06e851 to
f99df28
Compare
|
Preview removedAll preview folders cleaned from gh-pages branch. |
|
|
||
| function onAnimationFinish(isAccordionOpen: boolean) { | ||
| // Set the open attribute based on the parameter | ||
| _detailsEl.open = isAccordionOpen; |
There was a problem hiding this comment.
I'm really sorry about this. But your previous fix for my last issue introduced a new issue. Now because open isn't being set to false anymore in shrink(), aria-expanded isn't being updated properly, so now when you close an accordion, aria-expanded still reads as true, you can test this with any accordion in your PR example.
I would suggest maybe moving the open property handling to onAnimationFinish instead of handling it in shrink() or expand(), and just changing what the value is everytime it's run, open = isAccordionOpen ? "true" : "false";.
You have this line here that handles _detailsEl.open, but that doesn't modify open, which is what's deriving isOpen, which is what's used for aria-expanded.
There was a problem hiding this comment.
@ArakTaiRoth another good catch! 🤦 Sorry I missed that one, too. 😞
f99df28 to
164f54d
Compare
| } | ||
|
|
||
| function onAnimationFinish(isAccordionOpen: boolean) { | ||
| console.log("onfinish"); |
164f54d to
18e0383
Compare
|
🎉 This PR is included in version 2.0.0-dev.14 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 7.0.0-dev.7 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 5.0.0-dev.7 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 2.0.0-dev.6 🎉 The release is available on: Your semantic-release bot 📦🚀 |




Before (the change)
Accordion is all unrefined and gross. 🤢
After (the change)
Fixed all discrepancies from issue #3625.
--goa-motion-duration-short-2--goa-motion-curve-expressiveand--goa-motionDuration-short-3--goa-motion-curve-expressive-exitand--goa-motionDuration-short-3Make sure that you've checked the boxes below before you submit the PR
Steps needed to test
Make sure you check out the
eric/3625-accordion-refinementsbranch from design-tokens and updatepackage.jsondevDependenciesto use it:Run
npm iafter making the change.This PR will close Issue #3625