From 5a4b76f3ddfc10381a2636790b2372fb956c99b6 Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Willms Date: Tue, 11 Feb 2025 08:01:50 +0000 Subject: prevent tooltips in dialogs from being automatically focussed, fixes #773 Closes #773 Merge request studip/studip!3919 --- resources/assets/javascripts/lib/dialog.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/resources/assets/javascripts/lib/dialog.js b/resources/assets/javascripts/lib/dialog.js index 2810319..3459705 100644 --- a/resources/assets/javascripts/lib/dialog.js +++ b/resources/assets/javascripts/lib/dialog.js @@ -382,9 +382,16 @@ Dialog.show = function(content, options = {}) { instance.fixedDimensions = true; instance.dimensions = ui.size; }, - open() { + open(event) { PageLayout.title = dialog_options.title; + // Prevent tooltips from being automatically focussed + if (event.target.querySelector('[autofocus]') === null) { + $(':tabbable.tooltip:focus').data('tooltipObject')?.hide(); + $(':tabbable:not(.tooltip):first', event.target).trigger('focus'); + } + + // Adjust titlebar of dialog const helpbar_element = $('.helpbar a[href*="hilfe.studip.de"]'); const tooltip = helpbar_element.text(); const link = options.wiki_link || helpbar_element.attr('href'); -- cgit v1.0