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 @rootEventType argument and set mousedown as default #1819

Merged
merged 2 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/app/templates/public-pages/docs/api-reference.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,14 @@
open or close.
</td>
</tr>
<tr>
<td>rootEventType</td>
<td><code>string</code></td>
<td>
Defaults to <code>"mousedown"</code>. Indicates the type of event the component will be listening to
in order to close.
</td>
</tr>
<tr>
<td>matcher</td>
<td><code>function</code></td>
Expand Down
1 change: 1 addition & 0 deletions ember-power-select/src/components/power-select.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
@calculatePosition={{@calculatePosition}}
@triggerComponent={{ensure-safe-component @ebdTriggerComponent}}
@contentComponent={{ensure-safe-component @ebdContentComponent}}
@rootEventType={{or @rootEventType "mousedown"}}
as |dropdown|>
{{#let (assign dropdown (hash
selected=this.selected
Expand Down
1 change: 1 addition & 0 deletions ember-power-select/src/components/power-select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export interface PowerSelectArgs {
triggerClass?: string;
ariaInvalid?: string;
eventType?: string;
rootEventType?: string;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should change to rootEventType?: 'click' | 'mousedown';, because only this two types are allowed.

But the better way is that we export this types in ebd, so this is always syned.
I have also discoverd that in ebd we have one time delared as string and one strict to click/mousedown. I will look to fix it in ebd and than, when we release the ebd we do update the type also here

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type changed in #1846

ariaDescribedBy?: string;
calculatePosition?: CalculatePosition;
ebdTriggerComponent?: string | ComponentLike<any>;
Expand Down