maui icon indicating copy to clipboard operation
maui copied to clipboard

[WinUI] First Entry gets focus when window is re-activated

Open sjorsmiltenburg opened this issue 5 months ago • 3 comments

Description

I have a stack layout with multiple expanders full of filter options. When the top expander with the entry box is expanded, and a user scrolls down, clicks another program (window) and clicks back to my application there seems to be logic that wants to auto-focus the first entry, which is at the top of the scrollview, and therefore the scrollview scrolls up this is unwanted behaviour as I want to keep the current scrollposition

This seems to be very much related to https://github.com/dotnet/maui/issues/11472 which was fixed. I would like to be able to disable ths auto-focus behaviour of my app.

Image

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

9.0.70 SR7

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

No response

Affected platforms

Windows

Affected platform versions

No response

Did you find any workaround?

no

Relevant log output


sjorsmiltenburg avatar Jun 03 '25 14:06 sjorsmiltenburg

We've found some similar issues:

  • #11472 , similarity score: 83%
  • #23911 , similarity score: 82%

If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.

Note: You can give me feedback by 👍 or 👎 this comment.

similar-issues-ai[bot] avatar Jun 03 '25 14:06 similar-issues-ai[bot]

issues in this area make windows apps nearly unusable as some pages will just unexpectedly jump to the top as it hunts for a control to auto-focus to.

MitchBomcanhao avatar Jun 06 '25 13:06 MitchBomcanhao

I've created a basic project that reproduces a similar issue, not exactly as described here but the end result is very close, so it likely is related - https://github.com/MitchBomcanhao/BugWindowsFocus run the app on a window, so that the entire layout doesn't fit and you have to scroll down.

My app has a first page with

  • an editor
  • an entry
  • some empty space
  • a button
  1. you type something in the entry, just to prove that focus is moved into the second item in the page.
  2. scroll down to the bottom of the page.
  3. you then click the button, which will navigate into a modal page.
  4. click the modal page's single button, which will pop that page.
  5. OBSERVE
  • you find yourself back on the main page,
  • the page has been scrolled back to the top
  • focus has shifted to the first item in the page, the editor.

MitchBomcanhao avatar Jun 17 '25 14:06 MitchBomcanhao

This issue has been verified in Visual Studio 17.14.0 Preview 4.0 with MAUI versions (8.0.100, 9.0.0, 9.0.70 & 9.0.80). It can be reproduced on Windows platform.

ghost avatar Jun 19 '25 11:06 ghost