You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
523 B
16 lines
523 B
import { Controller } from '@hotwired/stimulus'; |
|
|
|
/** |
|
* Closes the <details> dropdown after a list action (link or button) so the panel does not stay open. |
|
*/ |
|
export default class extends Controller { |
|
closeAfterMenuAction(event) { |
|
const action = event.target.closest('.nostr-share-menu__list .nostr-share-menu__action'); |
|
if (!action || !this.element.contains(action)) { |
|
return; |
|
} |
|
queueMicrotask(() => { |
|
this.element.removeAttribute('open'); |
|
}); |
|
} |
|
}
|
|
|