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(comp:*): animating overlay are not hidden anymore #1516

Merged
merged 1 commit into from Mar 30, 2023

Conversation

sallerli1
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines
  • Tests for the changes have been added/updated or not needed
  • Docs and demo have been added/updated or not needed

What is the current behavior?

正在执行动画的浮层,也会受到 reference hidden 影响

What is the new behavior?

正在执行动画的浮层不会因为 reference hidden 被隐藏

Other information

@idux-bot
Copy link

idux-bot bot commented Mar 27, 2023

This preview will be available after the AzureCI is passed.

const { triggerId } = props
const overlayId = triggerId != null ? `__IDUX_OVERLAY-${triggerId}` : undefined
const style = `z-index: ${currentZIndex.value}`
const overlay = (
<div ref={popperRef} id={overlayId} class={prefixCls} style={style} {...popperEvents.value} {...attrs}>
<div ref={popperRef} id={overlayId} class={classes} style={style} {...popperEvents.value} {...attrs}>
{contentNode}
{props.showArrow && <div ref={arrowRef} class={`${prefixCls}-arrow`}></div>}
</div>
Copy link

Choose a reason for hiding this comment

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

with a review on the code patch.

The code patch adds a new state variable, isAnimating, and uses it to conditionally add an animation class to the overlay element. It also adds a beforeEnter callback to the Transition component which updates the isAnimating state.

Overall, the patch looks fine. However, there are a few things that could be improved:

  1. It would be better to use the enter/leave callbacks on the Transition component instead of adding a separate beforeEnter callback.
  2. The logic for setting the class on the overlay element should be improved to make it more concise and readable.
  3. The ternary operator used to conditionally render the overlay element should be refactored to use an if statement.

@@ -63,7 +63,7 @@
}
}

&[data-popper-reference-hidden] {
&[data-popper-reference-hidden]:not(&-animating) {
visibility: hidden;
opacity: 0;
pointer-events: none;
Copy link

Choose a reason for hiding this comment

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

the code review

The patch of code looks like it is trying to hide a data popper reference while not animating.The syntax looks correct, however, it is important to check if the data popper reference is being hidden as expected when not animating. It would be beneficial to add a unit test to ensure that the data popper reference is properly hidden when not animating. If necessary, more tests can be added to cover other scenarios and test for regressions. Additionally, it would be beneficial to refactor the code to make sure that it is more readable and easier to maintain.

@codecov
Copy link

codecov bot commented Mar 27, 2023

Codecov Report

Merging #1516 (423eb47) into main (703122f) will increase coverage by 0.02%.
The diff coverage is 97.14%.

❗ Current head 423eb47 differs from pull request most recent head 22b9f89. Consider uploading reports for the commit 22b9f89 to get more accurate results

@@            Coverage Diff             @@
##             main    #1516      +/-   ##
==========================================
+ Coverage   92.75%   92.77%   +0.02%     
==========================================
  Files         331      332       +1     
  Lines       30801    30892      +91     
  Branches     3533     3555      +22     
==========================================
+ Hits        28568    28661      +93     
+ Misses       2233     2231       -2     
Impacted Files Coverage Δ
...ckages/components/_private/overlay/src/Overlay.tsx 95.53% <81.25%> (-1.15%) ⬇️
...ckages/components/_private/date-panel/src/utils.ts 100.00% <100.00%> (ø)
...ages/components/_private/selector/src/Selector.tsx 91.15% <100.00%> (+0.06%) ⬆️
packages/components/_private/selector/src/token.ts 100.00% <100.00%> (ø)
packages/components/button/src/Button.tsx 95.37% <100.00%> (ø)
packages/components/timeline/src/TimelineItem.tsx 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@danranVm danranVm merged commit 3d4ce98 into IDuxFE:main Mar 30, 2023
7 checks passed
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.

None yet

2 participants