fix(v3/windows): restore modal owner activation on close - #6055
fix(v3/windows): restore modal owner activation on close#6055myparsleycat wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. WalkthroughThe Windows modal cleanup logic now uses a shared owner-release helper. The ChangesWindows modal owner activation
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This change restores activation to the modal owner when a foreground Windows modal closes while preventing background modals from stealing focus. Regression tests cover the required behavior, and no actionable merge-blocking risk remains beyond normal checks and review. Sequence Diagram(s)sequenceDiagram
participant ModalWindow
participant OwnerWindow
participant WindowsUser32
ModalWindow->>ModalWindow: Capture focus state
ModalWindow->>OwnerWindow: Re-enable owner
ModalWindow->>WindowsUser32: Activate owner when modal was focused
ModalWindow->>WindowsUser32: DefWindowProc WM_CLOSE
WindowsUser32-->>ModalWindow: Return close result
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Linked Issues checkExplanation The implementation meets issue Full details: Description checkExplanation The description is complete and relevant. It explains the bug, fix, issue reference, test coverage, Windows configuration, and checklist status. It also clearly documents the unrelated Windows test failure that prevents marking all tests as passing.
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description
On Windows, closing a foreground attached modal can activate an unrelated application instead of returning activation to the modal owner.
The current
WM_CLOSEpath re-enables the owner only afterDefWindowProcdestroys the modal. This change records whether the modal is foreground, re-enables the owner before destruction, and activates the owner when appropriate. A background modal does not activate its owner, so closing it does not steal focus.This also adds Windows regression tests for the required release and activation order.
Fixes #6054
Type of change
How Has This Been Tested?
Reproduced with a separate application using tagged
github.com/wailsapp/wails/v3 v3.0.0-beta.15.Applied only this patch through a local module replacement and verified that both immediate and delayed modal closure return activation to the owner.
Verified that an unrelated application no longer moves in front of the owner when the foreground modal closes.
Ran
GOTOOLCHAIN=go1.25.0 go test ./pkg/application -count=1successfully.Ran
GOTOOLCHAIN=go1.25.0 go test -timeout 10m ./...; all relevant packages passed. The current upstreaminternal/wake/exectests still fail on Windows because they invoke the POSIXtruecommand throughcmd.exe.Windows
macOS
Linux
Test Configuration
Checklist:
website/src/pages/changelog.mdxwith details of this PR (not applicable; this is a v3 fix)internal/wake/execfailures described above)Summary by CodeRabbit