From: Alexander Ebert Date: Wed, 29 Jun 2022 13:47:47 +0000 (+0200) Subject: Delay the auto focus of the submit button X-Git-Tag: 5.5.0_RC_3~10 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=65dbb26e7a69fc3cf9bb9819b82bc535db3645b3;p=GitHub%2FWoltLab%2FWCF.git Delay the auto focus of the submit button Safari delays the execution of the `blur` event on the document which causes the focus shift to happen too early. Delaying it by two event cycles are enough to provide a consistent experience and to avoid conflicts with the focus trap. See https://www.woltlab.com/community/thread/296069-best%C3%A4tigung-bei-installation-von-paket-%C3%BCber-entwickler-werkzeuge-nicht-direkt-pe/ --- diff --git a/ts/WoltLabSuite/Core/Ui/Confirmation.ts b/ts/WoltLabSuite/Core/Ui/Confirmation.ts index 5de324c8c3..90bdb6ff0b 100644 --- a/ts/WoltLabSuite/Core/Ui/Confirmation.ts +++ b/ts/WoltLabSuite/Core/Ui/Confirmation.ts @@ -122,8 +122,10 @@ class UiConfirmation implements DialogCallbackObject { * Sets the focus on the confirm button on dialog open for proper keyboard support. */ _onShow(): void { - this.confirmButton.blur(); - this.confirmButton.focus(); + window.setTimeout(() => { + this.confirmButton.blur(); + this.confirmButton.focus(); + }, 1); } _dialogSetup(): ReturnType { diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Confirmation.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Confirmation.js index f2d59027e4..193fce76ef 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Confirmation.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Confirmation.js @@ -93,8 +93,10 @@ define(["require", "exports", "tslib", "../Core", "../Language", "./Dialog"], fu * Sets the focus on the confirm button on dialog open for proper keyboard support. */ _onShow() { - this.confirmButton.blur(); - this.confirmButton.focus(); + window.setTimeout(() => { + this.confirmButton.blur(); + this.confirmButton.focus(); + }, 1); } _dialogSetup() { return {