From 48d84491ab92936d62abd59dbbcb404440c824c7 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Tue, 18 Jun 2024 16:04:49 +0200 Subject: [PATCH] Automatically focus the last modal button so that pressing enter submits the modal directly --- assets/js/utils/message.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/assets/js/utils/message.js b/assets/js/utils/message.js index dd1ef2fc..8ba3d2a5 100644 --- a/assets/js/utils/message.js +++ b/assets/js/utils/message.js @@ -105,6 +105,10 @@ window.App.Utils.Message = (function () { backdrop: 'static', }); + $messageModal.on('shown.bs.modal', () => { + $messageModal.find('.modal-footer button:last').focus(); + }); + messageModal.show(); $messageModal.css('z-index', '99999').next().css('z-index', '9999');