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

Make sure the content parent element is set before animating out #639

Merged
merged 1 commit into from
Feb 4, 2022

Conversation

gwak
Copy link
Contributor

@gwak gwak commented Jan 5, 2022

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 no dropdownElement.parentElement is null. So before the check I just try to get the parentElement through the destinationElement.

@gwak
Copy link
Contributor Author

gwak commented Feb 4, 2022

Hello, how can I help to make this PR merged.

@cibernox
Copy link
Owner

cibernox commented Feb 4, 2022

Sorry, I missed this PR completely

@cibernox cibernox merged commit 90b0f62 into cibernox:master Feb 4, 2022
@cibernox
Copy link
Owner

cibernox commented Feb 4, 2022

Merged! I'm going to cut a new release.

@cibernox
Copy link
Owner

cibernox commented Feb 4, 2022

4.0.3 contains this change. Thanks again 🙏

@gwak
Copy link
Contributor Author

gwak commented Feb 4, 2022

@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;
Copy link

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

Copy link
Contributor Author

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
  • ...

Copy link
Owner

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.

Copy link

@erichaus erichaus Feb 7, 2022

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>

Copy link

@erichaus erichaus Feb 7, 2022

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.

Copy link

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.

Copy link

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.

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