Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set focus to package when searching with key strokes #3360

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tkohlmeier
Copy link
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
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
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
Owner

I will test and merge as soon as I can.

Thanks!

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.

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