Frameless draggable windows lose keyboard focus on Windows OS when dragging
Closed this issue · 1 comments
kbirk commented
Description
When using style="--wails-draggable:drag"
on a frameless window on Windows OS, dragging the window causes it to lose keyboard focus.
To have the window respond to keyboard input the user needs to click on the window again. If there is any movement during the click, the focus is lost again.
To Reproduce
- Set
Frameless
totrue
- Add
style="--wails-draggable:drag"
to thebody
element - Add a
document.addEventListener("keydown", ...);
handler - Drag window
- Press a key
- The handler will not trigger
Expected behaviour
The window should retain focus after the user moves it and respond to keyboard input
Screenshots
No response
Attempted Fixes
I've tried to force it to regain focus such as using Show
and ShowWindow
but it doesn't work.
I've also tried re-implementing dragging manually however the limitations with WindowGetPosition
. WindowSetPosition
, and ScreenGetAll
make it impossible to handle multiple screens correctly.
System Details
# Wails
Version | v2.9.2
# System
┌──────────────────────────────────────────────────────────────────────────────────────┐
| OS | Windows 10 Home |
| Version | 2009 (Build: 22631) |
| ID | 23H2 |
| Go Version | go1.23.3 |
| Platform | windows |
| Architecture | amd64 |
| CPU | Intel(R) Core(TM) i5-14600K |
| GPU 1 | NVIDIA GeForce RTX 4070 SUPER (NVIDIA) - Driver: 32.0.15.6636 |
| GPU 2 | Intel(R) UHD Graphics 770 (Intel Corporation) - Driver: 32.0.101.6129 |
| Memory | 32GB |
└──────────────────────────────────────────────────────────────────────────────────────┘
# Dependencies
┌────────────────────────────────────────────────────────┐
| Dependency | Package Name | Status | Version |
| WebView2 | N/A | Installed | 131.0.2903.112 |
| Nodejs | N/A | Installed | 22.11.0 |
| npm | N/A | Installed | 10.9.0 |
| *upx | N/A | Available | |
| *nsis | N/A | Available | |
└─────────────── * - Optional Dependency ────────────────┘
# Diagnosis
Optional package(s) installation details:
- upx : Available at https://upx.github.io/
- nsis : More info at https://wails.io/docs/guides/windows-installer/
SUCCESS Your system is ready for Wails development!
Additional context
No response