ember-basic-dropdown
ember-basic-dropdown copied to clipboard
Add a test demonstrating no-trigger bug
Sometime between v1.x and v3.x a regression was introduced when specifying a dropdown that has no trigger, like in the cookbook entry. (https://ember-basic-dropdown.com/cookbook/no-trigger)
I don't know how to fix the bug, but this test fails and demonstrates it reproducibly.
I think the root cause is that BasicDropdownContent
never gets triggerElement
set if you don't use <dd.Trigger>
. So when you click again on your custom trigger, handleRootMouseDown
fires and can't disqualify the click. So it calls the close
action. Then, your custom trigger also handles the click and calls toggle
. It closes and re-opens in one click!
In the previous version we used, which is the ancient v1.x, BasicDropdownContent
would do the data-ebd-id
lookup when open
was called. This allowed it to have triggerElement
set even if <dd.trigger>
isn't used.
See:
https://github.com/cibernox/ember-basic-dropdown/blob/v1.1.3/addon/components/basic-dropdown/content.js#L145-L147