-
Notifications
You must be signed in to change notification settings - Fork 184
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
Make sure the content parent element is set before animating out #639
Conversation
Hello, how can I help to make this PR merged. |
Sorry, I missed this PR completely |
Merged! I'm going to cut a new release. |
4.0.3 contains this change. Thanks again 🙏 |
@cibernox Thank you! |
@@ -149,7 +149,8 @@ export default class BasicDropdownContent extends Component<Args> { | |||
@action | |||
animateOut(dropdownElement: Element): void { | |||
if (!this.animationEnabled) return; | |||
let parentElement = dropdownElement.parentElement; | |||
let parentElement = | |||
dropdownElement.parentElement ?? this.destinationElement; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is causing a weird double animate out in my app
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, thanks for the feedback @hoIIer, I can have a look, but could you please be more specific on your context, like:
- Browser + OS (Does the animation on the docs behaves normally on your browser ?)
- Animation css you're using
- renderInPlace or not
- ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hoIIer Also interested, It didn't cause any problem on mine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- happens in both chrome/firefox latest in osx
- using custom calculated position that sets css animation dynamically
- not using renderInPlace
e.g. output of this.calcPosition
animation: "popoutFadeInSlideLeft 0.1s ease-in-out"
right: 709.5
top: 433.1796875
@keyframes popoutFadeInSlideLeft {
from {
opacity: 0;
transform: translateX(-15px);
}
to {
opacity: 1;
transform: translateX(0px);
}
}
When I remove the style.animation = ...
the popout looks normal
<BasicDropdown
@calculatePosition={{this.calcPosition}}
as |dd|
>
{{yield (hash
dd=dd
trigger=(
component 'popout-menu/trigger'
componentStyle=(get-style this)
disableMenu=@disableMenu
dropdown=dd
name=@name
visible=@visible
)
menu=(
component 'popout-menu/menu'
componentStyle=(get-style this)
dropdown=dd
onClickOverlay=this.onClickOverlay
theme=@theme
)
componentStyle=(get-style this)
)}}
</BasicDropdown>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I extended the animation duration to 10 seconds and noticed when closing the dropdown, the content menu is immediately reset to it's starting position, but it still has the animation value set so it does a 2nd animation in before closing.
Tried unsetting it with --transitioning-out but it seemed to have no effect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed that in 4.0.2
the content menu does not reset to original position after clicking out to close the dropdown, the <div id="ember-basic-dropdown-wormhole"></div>
just becomes empty again.
In 4.0.3
when clicking out to close the dropdown, the content menu appears again inside the parent container and with a --clone
css class, leading to the 2nd animation before it's removed entirely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can revisit later today, perhaps I need to adjust how I'm setting the animation? In this case I have to set it dynamically within the calcPosition function because my contextual dropdown is used in different contexts.
This is a follow-up to the PRs #623 and #628. The fix on the animation flow worked well when the dropdown is rendered in place. Not so well when not because the parent element is lost when the content element is closed.
In the
animateOut
function, there's an early exit when nodropdownElement.parentElement
is null. So before the check I just try to get the parentElement through thedestinationElement
.