ember-basic-dropdown icon indicating copy to clipboard operation
ember-basic-dropdown copied to clipboard

'parentElement.appendChild' error thrown in 3.17

Open mehulkar opened this issue 5 years ago • 9 comments

Unhandled Promise Rejection: TypeError: null is not an object (evaluating 'parentElement.appendChild')

With Ember 3.17.x and EBD 2.0.11 I see an error when dismissing the dropdown. This is bubbling up to EPS also.

<BasicDropdown as |dd|>
  <dd.Trigger>Click me</dd.Trigger>
  <dd.Content>Hello world hi</dd.Content>
</BasicDropdown>

mehulkar avatar Mar 31 '20 00:03 mehulkar

I tried running the test suite against 3.17 with ember-try, but looks like this code path is not hit because animations are disabled in test. Same thing reproduces in 2.0.13, but I can workaround it by passing @animationsEnabled={{false}}.

The base issue is that parentElement of the dropdown does not exist by the time the animateOut function runs through the will-destroy modifier.

This may be related to the willDestroy fixes that went into 3.17.2 here https://github.com/emberjs/ember.js/pull/18837 and https://github.com/emberjs/ember.js/pull/18838, but I'm not sure how to debug further.

cc @pzuraq do you have any insight?

mehulkar avatar Mar 31 '20 00:03 mehulkar

code refs:

  • https://github.com/cibernox/ember-basic-dropdown/blob/v2.0.13/addon/templates/components/basic-dropdown-content.hbs#L18-L20
  • https://github.com/cibernox/ember-basic-dropdown/blob/v2.0.13/addon/components/basic-dropdown-content.js#L174

mehulkar avatar Mar 31 '20 01:03 mehulkar

Another problem is that @animationEnabled={{false}} does not work because when it's false, the getter will fallback to the default implementation: https://github.com/cibernox/ember-basic-dropdown/blob/v2.0.13/addon/components/basic-dropdown-content.js#L64-L67

I've submitted a fix for that here: https://github.com/cibernox/ember-basic-dropdown/pull/541

mehulkar avatar Mar 31 '20 01:03 mehulkar

I see a related PR/Issue in EPS here: https://github.com/cibernox/ember-power-select/issues/1338

mehulkar avatar Mar 31 '20 01:03 mehulkar

@mehulkar Did you know if (https://github.com/emberjs/ember.js/issues/18855) fix the problem?

alex9nadon avatar May 06 '20 12:05 alex9nadon

@alex9nadon not sure. I ended up upgrading EBS /EPS to the glimmer versions to workaround this problem.

mehulkar avatar May 06 '20 17:05 mehulkar

I'm running into this issue with Ember 3.19 and EBD 3.0.6. Did anyone manage to resolve this without disabling animations?

adambedford avatar Jul 04 '20 05:07 adambedford

Is there a work around considering #550 ?

k-dauda avatar Aug 11 '20 18:08 k-dauda

In Ember 3.20 we have this issue everywhere with both EBD 2.x and 3.x

Edit: I believe our issue is that we are also running ember-power-select-typeahead which has a dependancy of ember-power-select "^3.0.3", which in turn pulls in ember-basic-dropdown "^2.0.13"

edflips avatar Aug 16 '20 12:08 edflips

Closing this issue, as its related to older ebd versions and the mentioned were refacored in newer vesion

If this issue is still present with latest version, let me know

mkszepp avatar Mar 16 '24 11:03 mkszepp