Skip to content

Set focus to package when searching with key strokes#3360

Merged
Martí Climent (marticliment) merged 5 commits intoDevolutions:mainfrom
tkohlmeier:fix-package-focus
Mar 5, 2025
Merged

Set focus to package when searching with key strokes#3360
Martí Climent (marticliment) merged 5 commits intoDevolutions:mainfrom
tkohlmeier:fix-package-focus

Conversation

@tkohlmeier
Copy link
Copy Markdown
Contributor

  • I have read the contributing guidelines, and I agree with the Code of Conduct.
  • Have you checked that there aren't other open pull requests for the same changes?
  • Have you tested that the committed code can be executed without errors?
  • This PR is not composed of garbage changes used to farm GitHub activity to enter potential Crypto AirDrops.
    Any user suspected of farming GitHub activity with crypto purposes will get banned. Submitting broken code wastes the contributors' time, who have to spend their free time reviewing, fixing, and testing code that does not even compile breaks other features, or does not introduce any useful changes. I appreciate your understanding.

Using FindDescendant() to find the selected PackageItemContainer to focus it after selecting it. Also using StartBringItemIntoView() to scroll to item.

This fixes checking the package by pressing Space, but when pressing Up or Down, the wrong package is still selected (that's why this PR is a draft).


Closes #3355

@tkohlmeier
Copy link
Copy Markdown
Contributor Author

tkohlmeier commented Feb 26, 2025

Now handling PreviewKeyDown event to handle Up/Down/Home/End keys which works nicely most of the time. Sometimes, a wrong package is being selected, not sure why.

It's really sad that we have to handle such basic functionality ourselves...

@tkohlmeier
Copy link
Copy Markdown
Contributor Author

I think I was able to solve all problems. The CharacterReceived listener had to be moved to PackageList since otherwise the search input would lose focus when entering text. Focus() is called with FocusState.Keyboard because FocusState.Programmatic is buggy and sometimes breaks PageUp/Down functionality. I also had to handle Up/Down/Home/End keys since the default handling is also buggy.

Note that I changed the scroll position from index - 3 to index since this is common behavior, but of course I can revert that if you disagree.

@tkohlmeier tkohlmeier marked this pull request as ready for review March 1, 2025 10:59
@marticliment
Copy link
Copy Markdown
Collaborator

I will test and merge as soon as I can.

Thanks!

@marticliment Martí Climent (marticliment) merged commit 878bd18 into Devolutions:main Mar 5, 2025
2 checks passed
@marticliment
Copy link
Copy Markdown
Collaborator

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Searching in package list with key presses does not focus item

2 participants