Skip to content

Suppress tooltips on windows that are not active#11402

Merged
niksedk merged 1 commit into
mainfrom
fix-tooltips-when-window-inactive
Jun 4, 2026
Merged

Suppress tooltips on windows that are not active#11402
niksedk merged 1 commit into
mainfrom
fix-tooltips-when-window-inactive

Conversation

@niksedk
Copy link
Copy Markdown
Member

@niksedk niksedk commented Jun 4, 2026

Summary

Avalonia opens a tooltip on hover regardless of whether the owning window is foregrounded. On macOS this lets SE's toolbar hints leak in front of whatever other app the user is currently working in — they see "Open subtitle file" floating over their browser. Native macOS apps suppress tooltips when their window is not key.

Fixes the report that toolbar hints fire when other windows are active (at least on macOS).

Change

Register a global ToolTip.IsOpenProperty class handler in Program.ConfigureApplication that cancels the open transition whenever the control's top-level Window isn't active:

ToolTip.IsOpenProperty.Changed.AddClassHandler<Control>((control, e) =>
{
    if (e.NewValue is true
        && TopLevel.GetTopLevel(control) is Window window
        && !window.IsActive)
    {
        ToolTip.SetIsOpen(control, false);
    }
});

The check generalizes to our own child windows too: when a dialog is open, the inactive main window stops showing hints, which matches user expectations across platforms. The handler is no-op on tooltips hosted on non-Window TopLevels (popups), so context-menu and flyout tooltips behave as before.

Targeting IsOpenProperty.Changed (rather than the individual Tip property on every control) means we don't need to enumerate the toolbar buttons or track their original tooltip content. New windows added in the future inherit the behavior automatically.

Test plan

  • On macOS: open SE, switch to another app (Safari/Finder), hover the SE toolbar buttons through the still-visible main window. Confirm no tooltips appear.
  • On macOS: open Find/Replace dialog, hover the (now-inactive) main toolbar. Confirm no tooltips appear.
  • On macOS: bring SE main window forward, hover toolbar — tooltips appear as usual.
  • On Windows / Linux: same checks; behavior should be identical.
  • Confirm context-menu and flyout tooltips (if any) still work — they're hosted on non-Window TopLevels and the check skips them.

🤖 Generated with Claude Code

Avalonia opens a tooltip on hover regardless of whether the owning
window is foregrounded. On macOS this lets SE's toolbar hints leak in
front of whatever other app the user is currently working in — they
see "Open subtitle file" floating over their browser. Native macOS
apps suppress tooltips when their window is not key.

Register a global ToolTip.IsOpenProperty class handler that cancels
the open transition whenever the control's top-level Window isn't
active. The check generalizes to our own child windows too: when a
dialog is open, the inactive main window stops showing hints, which
matches user expectations across platforms.

The handler is no-op on tooltips hosted on non-Window TopLevels
(popups), so context-menu and flyout tooltips behave as before.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@niksedk niksedk merged commit cc66695 into main Jun 4, 2026
1 of 3 checks passed
@niksedk niksedk deleted the fix-tooltips-when-window-inactive branch June 4, 2026 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant