Skip to content

[bug] Tray window blur event not triggered after second show() call #13633

Closed
@i-CNNN

Description

@i-CNNN

Describe the bug

I created a custom tray window in Tauri. When I first call window.show() on the tray window, triggering a blur event (e.g., by clicking outside the window) correctly hides the window. However, after calling window.show() again to redisplay the tray window, the blur event no longer fires when the window loses focus. This prevents the window from being hidden again unless I manually click on the tray window first to "reactivate" it.

Environment:

  • Tauri Version: [e.g., 2.5.1]
  • OS: [e.g., Windows 11]

Reproduction

  1. Create a tray window with WindowBuilder (or similar).
  2. Call window.show() for the first time.
  3. Trigger a blur event (e.g., click outside the window). The window hides as expected.
  4. Call window.show() again to redisplay the tray window.
  5. Attempt to trigger a blur event (e.g., click outside the window again). The event is not fired, and the window remains visible.
  6. Click directly on the tray window to "focus" it, then clicking outside will finally hide it.

Expected behavior

The blur event should consistently fire every time the tray window loses focus, regardless of how many times show() is called.

Full tauri info output

...

Stack trace


Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions