diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2025-02-11 08:01:50 +0000 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2025-02-13 10:13:20 +0100 |
| commit | 2c517d196d44dcfabb952b8947a29a525fcfd563 (patch) | |
| tree | 86d8414fc3c798b077d881e326038c0876e0f3bb /resources | |
| parent | 5a9727219100943524797f4d8edf42554a6be96d (diff) | |
prevent tooltips in dialogs from being automatically focussed, fixes #773
Closes #773
Merge request studip/studip!3919
Diffstat (limited to 'resources')
| -rw-r--r-- | resources/assets/javascripts/lib/dialog.js | 24 |
1 files 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 = $('<a class="ui-dialog-titlebar-wiki"' + ' target="_blank" rel="noopener noreferrer">') - .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 = $('<a class="ui-dialog-titlebar-wiki"' + ' target="_blank" rel="noopener noreferrer">') + .attr('href', link) + .attr('title', tooltip); if (options.wikilink) { $(this) |
