Add a test demonstrating no-trigger bug #622
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 getstriggerElement
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 theclose
action. Then, your custom trigger also handles the click and callstoggle
. It closes and re-opens in one click!In the previous version we used, which is the ancient v1.x,
BasicDropdownContent
would do thedata-ebd-id
lookup whenopen
was called. This allowed it to havetriggerElement
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