ember-basic-dropdown
ember-basic-dropdown copied to clipboard
Does not work without <Trigger>
Even though it says it should work without a trigger (https://ember-basic-dropdown.com/cookbook/no-trigger/), that does not seem to be the case.
E.g. I have a usage like this (simplified):
<button {{on "click" this.openDropdown}}>Open dropdown</button>
<BasicDropdown @registerAPI={{this.registerAPI}} as |dd|>
<dd.Content>
My content
</dd.Content>
</BasicDropdown>
import { action } from '@ember/object';
import Component from '@glimmer/component';
export default class MaintenanceTasksQuickSearchIndexComponent extends Component {
dropdownAPI;
@action
registerAPI(dropdownAPI) {
this.dropdownAPI = dropdownAPI;
}
@action
openDropdown() {
this.dropdownAPI.actions.open();
}
}
But it does not open the dropdown when calling openDropdown()
. It does work if I add <dd.Trigger />
.
The cookbook says you also need to set data-ebd-id="{{dd.uniqueId}}-trigger"
so that the content knows which element to render near. If no element can be found with that data attr, it might appear like the content didn't render, but it's actually drawn at (0,0) or something.
https://ember-basic-dropdown.com/cookbook/no-trigger