Skip to content

Commit

Permalink
Don't trigger tooltip on focusBack element
Browse files Browse the repository at this point in the history
If Overlay's focusBack event has a tooltip associated with it, we don't
want to trigger it when automatically giving it focus when dismissing
the overlay. Accomplish this by immediately dismissing tooltips after
giving the element focus, which will clear out any tooltip timers.
  • Loading branch information
danrahn committed Nov 5, 2023
1 parent 733bf09 commit 8318ee1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Client/Script/inc/Overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,13 @@ const Overlay = new function() {
this.dismiss = function() {
const main = Overlay.get();
const ret = animateOpacity(main, 1, 0, 250, true /*deleteAfterTransition*/);
Tooltip.dismiss();

focusBack?.focus();
focusBack = null;

// Dismiss after setting focus, as Tooltip's 'show on focus' behavior can be
// annoying if it's not the user that's setting focus
Tooltip.dismiss();
for (const dismiss of dismissCallbacks) {
dismiss();
}
Expand Down

0 comments on commit 8318ee1

Please sign in to comment.