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

Add a test demonstrating no-trigger bug #622

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

apellerano-pw
Copy link

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

Sometime between v1.x and v3.x a regression was introduced when
specifying a dropdown that has no trigger, in accordance with the
cookbook entry.

https://ember-basic-dropdown.com/cookbook/no-trigger

This is a test that asserts the cookbook functionality, to guard
against regressions.
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.

1 participant