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

fix(dialog): fade-out animation when lazy loaded on popover overlays #4937

Merged
merged 10 commits into from
Nov 19, 2024

Conversation

mizgaionutalexandru
Copy link
Contributor

@mizgaionutalexandru mizgaionutalexandru commented Nov 15, 2024

Description

This PR updates the moment of the close event dispatch from the DialogBase to happen after all the component is done animating. If the transition duration is 0, the event will dispatch instantly as before.

Related issue(s)

  • N/A

Motivation and context

Using a DialogBase inside a lazy-loaded overlay content would not always allow for the fade-out animations to complete. Unsure why this issue happens only with the popover overlay, but this fix seems more in line with the documentation stating that the close event "announces that the dialog has been closed".

How has this been tested?

  • Test case 1

    1. Go to the lazy loaded DialogBase storybook
    2. Click on the button to open the dialog
    3. Click the button inside the dialog to close it
    4. Observe that the animation happens smoothly
    5. Repeat
  • Test case 2

    1. Go to the lazy loaded DialogBase storybook
    2. Activate the "Reduce Motion" switch from the storybook decorator
    3. Click on the button to open the dialog
    4. Click the button inside the dialog to close it
    5. Observe that the the dialog closes instantly
    6. Repeat
  • Did it pass in Desktop?

  • Did it pass in Mobile?

  • Did it pass in iPad?

Screenshots (if appropriate)

Before:

before.mov

After:

after.mov

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (minor updates related to the tooling or maintenance of the repository, does not impact compiled assets)

Checklist

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • If my change required a change to the documentation, I have updated the documentation in this pull request.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices

Best practices

This repository uses conventional commit syntax for each commit message; note that the GitHub UI does not use this by default so be cautious when accepting suggested changes. Avoid the "Update branch" button on the pull request and opt instead for rebasing your branch against main.

Copy link

github-actions bot commented Nov 15, 2024

Branch preview

Review the following VRT differences

When a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:

If the changes are expected, update the current_golden_images_cache hash in the circleci config to accept the new images. Instructions are included in that file.
If the changes are unexpected, you can investigate the cause of the differences and update the code accordingly.

Copy link

github-actions bot commented Nov 15, 2024

Lighthouse scores

Category Latest (report) Main (report) Branch (report)
Performance 0.99 0.97 0.98
Accessibility 1 1 1
Best Practices 1 1 1
SEO 1 0.92 0.92
PWA 1 1 1
What is this?

Lighthouse scores comparing the documentation site built from the PR ("Branch") to that of the production documentation site ("Latest") and the build currently on main ("Main"). Higher scores are better, but note that the SEO scores on Netlify URLs are artifically constrained to 0.92.

Transfer Size

Category Latest Main Branch
Total 250.276 kB 236.655 kB 236.551 kB 🏆
Scripts 60.614 kB 54.294 kB 54.128 kB 🏆
Stylesheet 53.844 kB 47.901 kB 🏆 48.003 kB
Document 6.214 kB 5.468 kB 5.468 kB
Font 126.782 kB 126.641 kB 126.604 kB 🏆

Request Count

Category Latest Main Branch
Total 52 52 52
Scripts 41 41 41
Stylesheet 5 5 5
Document 1 1 1
Font 2 2 2

Copy link

github-actions bot commented Nov 15, 2024

Tachometer results

Chrome

contextual-help permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 944 kB 52.85ms - 55.16ms - faster ✔
5% - 11%
2.88ms - 6.32ms
branch 898 kB 57.33ms - 59.88ms slower ❌
5% - 12%
2.88ms - 6.32ms
-

dialog permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 802 kB 79.42ms - 79.96ms - faster ✔
1% - 3%
0.39ms - 2.40ms
branch 759 kB 80.12ms - 82.05ms slower ❌
0% - 3%
0.39ms - 2.40ms
-
Firefox

contextual-help permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 944 kB 116.57ms - 122.31ms - faster ✔
1% - 7%
1.01ms - 9.31ms
branch 898 kB 121.60ms - 127.60ms slower ❌
1% - 8%
1.01ms - 9.31ms
-

dialog permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 802 kB 131.25ms - 141.15ms - unsure 🔍
-6% - +4%
-8.18ms - +5.06ms
branch 759 kB 133.35ms - 142.17ms unsure 🔍
-4% - +6%
-5.06ms - +8.18ms
-

@coveralls
Copy link
Collaborator

coveralls commented Nov 15, 2024

Pull Request Test Coverage Report for Build 11907435888

Details

  • 21 of 26 (80.77%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.01%) to 98.183%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/dialog/src/DialogBase.ts 21 26 80.77%
Totals Coverage Status
Change from base Build 11859867829: -0.01%
Covered Lines: 32346
Relevant Lines: 32768

💛 - Coveralls

@mizgaionutalexandru mizgaionutalexandru marked this pull request as ready for review November 15, 2024 15:59
@mizgaionutalexandru mizgaionutalexandru requested a review from a team as a code owner November 15, 2024 15:59
import { alertDestructive } from './dialog.stories.js';
import { portrait } from './images.js';
import { disabledButtonDecorator } from './index.js';

const withOverlayDecorator = (story: () => TemplateResult): TemplateResult => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This decorator needs to be initialized. This will create problems in VRT tests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe I'm missing something here but I'm not sure what you mean by initializing it. I extracted the function as it was previously defined for all the stories from this file, to be able to add it only where needed.
Is this related to the VRTs saying that this PR removes the disabledButton VRT (link)?

Copy link
Contributor

Choose a reason for hiding this comment

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

I see you are trying to add withOverlayDecorator decorator with every story! Instead of adding this as story.decorator = [withOverlayDecorator] you can initialise this as

export default { 
....
decorators:[withOverlayDecorator()]
}

But this is not something that will trigger the issue! In the mean time I see some flaky tests have emerged and a redundant hash is there. Can you please updated the hash and surface up the new baseline for slotted and re-trigger the runs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That decorator is used with every story except the one that this PR adds, that's why I extracted it from the default export, I don't want it applied in said story. That story is created different to emphasize the lazy loaded usage of the component.
As for the flaky tests, I will update the hash right away.

Copy link
Contributor

@Rajdeepc Rajdeepc Nov 18, 2024

Choose a reason for hiding this comment

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

OK this is failing coz when you add disabledButton.decorators = [withOverlayDecorator, disabledButtonDecorator], the decorators are not getting ready. Can you try adding them separately instead?

disabledButton.decorators = [withOverlayDecorator];
disabledButton.decorators = [disabledButtonDecorator];

OR combining the decorators?

const combinedDecorator = () => {
  withOverlayDecorator();
  disabledButtonDecorator();
};
disabledButton.decorators = [combinedDecorator];

@mizgaionutalexandru mizgaionutalexandru force-pushed the imizga/trigger-directive-transition branch from 12aa2ad to 10fa1f7 Compare November 18, 2024 16:34
@mizgaionutalexandru mizgaionutalexandru force-pushed the imizga/trigger-directive-transition branch from 10fa1f7 to 167f7d5 Compare November 18, 2024 16:35
@Rajdeepc
Copy link
Contributor

Good work here @mizgaionutalexandru. Let me know if we can land this now?

@Rajdeepc Rajdeepc merged commit d36fc6e into main Nov 19, 2024
27 checks passed
@Rajdeepc Rajdeepc deleted the imizga/trigger-directive-transition branch November 19, 2024 07:00
nikkimk pushed a commit that referenced this pull request Nov 19, 2024
…4937)

* fix(dialog): fade-out animation when lazy loaded on popover overlays

* fix(dialog): missing fade-out animations close dispatch

* chore: update storybook paragraph

* fix: underlay guard

* chore: hash update

* chore: golden hash update

* ci: updated golden image cache

* fix: combined decorators

* ci: updated golden image cache

---------

Co-authored-by: TaraT <ttomar@adobe.com>
Co-authored-by: Rajdeep Chandra <rajdeepchandra@Rajdeeps-MacBook-Pro-2.local>
Co-authored-by: Rajdeep Chandra <rajdeepchandra@rajdeeps-mbp-2.macromedia.com>
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