DEV: allows d-menu to refocus trigger (#30522)

This commit is contained in:
Joffrey JAFFEUX
2025-01-02 09:31:15 +01:00
committed by GitHub
parent e04af92740
commit a5ba788a23
5 changed files with 56 additions and 4 deletions

View File

@@ -4,6 +4,7 @@ import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { getOwner } from "@ember/owner";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import willDestroy from "@ember/render-modifiers/modifiers/will-destroy";
import { service } from "@ember/service";
import { modifier } from "ember-modifier";
import { and } from "truth-helpers";
@@ -39,6 +40,11 @@ export default class DMenu extends Component {
this.body = element;
}
@action
teardownFloatBody() {
this.body = null;
}
@action
forwardTabToContent(event) {
if (!this.body) {
@@ -151,6 +157,7 @@ export default class DMenu extends Component {
@role="dialog"
@inline={{this.options.inline}}
{{didInsert this.registerFloatBody}}
{{willDestroy this.teardownFloatBody}}
>
{{#if (has-block)}}
{{yield this.componentArgs}}