From 2c517d196d44dcfabb952b8947a29a525fcfd563 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 | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/resources/assets/javascripts/lib/dialog.js b/resources/assets/javascripts/lib/dialog.js index 8e8b269..65e9574 100644 --- a/resources/assets/javascripts/lib/dialog.js +++ b/resources/assets/javascripts/lib/dialog.js @@ -374,18 +374,22 @@ Dialog.show = function(content, options = {}) { instance.fixedDimensions = true; instance.dimensions = ui.size; }, - open: function() { + open(event) { PageLayout.title = dialog_options.title; - var helpbar_element = $('.helpbar a[href*="hilfe.studip.de"]'); - var tooltip = helpbar_element.text(); - var link = options.wiki_link || helpbar_element.attr('href'); - var element = $('') - .attr('href', link) - .attr('title', tooltip); - var buttons = $(this) - .parent() - .find('.ui-dialog-buttonset .ui-button'); + // 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'); + const element = $('') + .attr('href', link) + .attr('title', tooltip); if (options.wikilink) { $(this) -- cgit v1.0