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 for https://github.com/cibernox/ember-basic-dropdown/issues/615 #623

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions addon/components/basic-dropdown-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,14 @@ export default class BasicDropdownContent extends Component<Args> {
@action
animateOut(dropdownElement: Element): void {
if (!this.animationEnabled) return;
let parentElement = dropdownElement.parentElement;
if (parentElement === null) return;
if (this.args.renderInPlace) {
parentElement = parentElement.parentElement
}
this.animationClass = this.transitioningInClass;
let parentElement = this.destinationElement;
Copy link
Author

Choose a reason for hiding this comment

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

Not sure if this is the right fix, but what I was seeing is that the parentElement was always null on will-destroy calls. However, since we want to animate at the destination location I think this is right? Not sure 🤷‍♂️

if (parentElement === null) return;
let clone = dropdownElement.cloneNode(true) as Element;
clone.id = `${clone.id}--clone`;
clone.classList.remove(...this.transitioningInClass.split(' '));
clone.classList.add(...this.transitioningOutClass.split(' '));
parentElement.appendChild(clone);
this.animationClass = this.transitionedInClass;
waitForAnimations(clone, function() {
(parentElement as HTMLElement).removeChild(clone);
});
Expand Down