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

Does not work without <Trigger>

Open mydea opened this issue 4 years ago • 1 comments

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 />.

mydea avatar Sep 15 '20 12:09 mydea

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

apellerano-pw avatar Jun 16 '21 18:06 apellerano-pw