diff --git a/src/api/overlays/components/OverlayComponent.vue b/src/api/overlays/components/OverlayComponent.vue index 467bd96c54..491e2fdb68 100644 --- a/src/api/overlays/components/OverlayComponent.vue +++ b/src/api/overlays/components/OverlayComponent.vue @@ -182,10 +182,12 @@ }, inject: ['dismiss', 'element', 'buttons', 'dismissable'], mounted() { - this.$refs.element.appendChild(this.element); - setTimeout(() => { - this.getElementForFocus().focus(); - }, 0); + const element = this.$refs.element; + element.appendChild(this.element); + const elementForFocus = this.getElementForFocus() || element; + this.$nextTick(() => { + elementForFocus.focus(); + }); }, methods: { destroy: function () {