[Windows] Fix for SearchHandler.Focused and Unfocused event never fires#27577
Merged
rmarinho merged 4 commits intodotnet:mainfrom Feb 12, 2025
Merged
[Windows] Fix for SearchHandler.Focused and Unfocused event never fires#27577rmarinho merged 4 commits intodotnet:mainfrom
rmarinho merged 4 commits intodotnet:mainfrom
Conversation
Contributor
|
Hey there @BagavathiPerumal! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
Contributor
Author
|
@dotnet-policy-service terminate |
Contributor
Author
|
@dotnet-policy-service agree company="Syncfusion, Inc." |
jsuarezruiz
reviewed
Feb 5, 2025
| autoSuggestBox.TextChanged += OnSearchBoxTextChanged; | ||
| autoSuggestBox.QuerySubmitted += OnSearchBoxQuerySubmitted; | ||
| autoSuggestBox.SuggestionChosen += OnSearchBoxSuggestionChosen; | ||
| autoSuggestBox.GotFocus += OnSearchBoxGotFocus; |
Contributor
There was a problem hiding this comment.
Where do we unsubscribe from these events?
Contributor
Author
There was a problem hiding this comment.
@jsuarezruiz, The events are unsubscribed in the DisconnectHandler of ShellItemHandler. Please let me know if you have any other concerns.
…stBox in DisconnectHandler.
mattleibow
previously approved these changes
Feb 10, 2025
src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs
Outdated
Show resolved
Hide resolved
Member
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Member
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
rmarinho
approved these changes
Feb 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
The root cause of the issue is that the GotFocus and LostFocus events for the AutoSuggestBox control were not previously integrated with the SearchHandler's SetIsFocused method. As a result, the Focused and Unfocused events for the Shell.SearchHandler were not being triggered when the search handler gained or lost focus, leading to incorrect focus management behavior.
Description of Issue Fix
The fix involves connecting the GotFocus and LostFocus events of the AutoSuggestBox control to the SearchHandler's focus management. This is done by adding event handlers for these events in the UpdateSearchHandler method, which will call the SetIsFocused method when the AutoSuggestBox gains or loses focus. This ensures that the Focused and Unfocused events are triggered properly, allowing the search handler to respond when focus changes.
Tested the behavior in the following platforms.
Issues Fixed
Fixes #27551
Output
SearchHandler-BeforeFix.mp4
SearchHandler-AfterFix.mp4