Skip to content

Set previous focus target to editor that opens drawer#4562

Merged
tomasMizera merged 2 commits into
masterfrom
fix/read-only-editors-focus
Jun 26, 2026
Merged

Set previous focus target to editor that opens drawer#4562
tomasMizera merged 2 commits into
masterfrom
fix/read-only-editors-focus

Conversation

@tomasMizera

Copy link
Copy Markdown
Collaborator

Qt's Popup (and its subclasses Drawer, Dialog) saves Window.activeFocusItem when open() is called and restores it when the popup closes. In forms with a text editor above a dropdown or date field, the editor often held active focus at the moment the drawer opened - so on close, focus was returned to it, raising the on-screen keyboard and pushing content out of view.

Fix: call forceActiveFocus() on the editor component immediately before activating the Loader. This moves active focus to the component that logically "owns" the interaction, so the Popup saves it as the restore target. On close, focus returns to that component - not to a text editor further up the form.

Applied to:

  • Form editors: dropdowns, calendar, relation, relation reference, scanner, photo viewer
  • Filter inputs: dropdowns, calendar

Fixes #4522

@tomasMizera tomasMizera requested a review from Withalion June 25, 2026 12:22
@github-actions

Copy link
Copy Markdown

Coverage Report for CI Build 28169320711

Warning

No base build found for commit 74fdb5e on master.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 59.037%

Details

  • Patch coverage: No coverable lines changed in this PR.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 15636
Covered Lines: 9231
Line Coverage: 59.04%
Coverage Strength: 97.54 hits per line

💛 - Coveralls

@tomasMizera tomasMizera merged commit 8c70a4c into master Jun 26, 2026
12 of 13 checks passed
@tomasMizera tomasMizera deleted the fix/read-only-editors-focus branch June 26, 2026 08:04
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.

Form navigation - app returns focus to multi-line text field after value map selection, blocking access to fields below

1 participant