-
Notifications
You must be signed in to change notification settings - Fork 1.9k
#7956 [Shell] Unable to focus and unfocus search handler for Android #14375
Conversation
…Handlers triggering test. FAILS (does nothing)
…sed EventHandlers triggering test. FAILS (does nothing)
…textBlock. This is done in order to propagate any Focus state change from the textBlock (graphically, the search bar for the SearchHandler) to the SearchHandler IsFocused state. This causes the SearchHandler.OnIsFocusedPropertyChanged method to finally execute, as it was originally expected to do so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After testing the original cases as well as the new ones I've implemented, and reviewing the changes: As far as I'm concerned the impact of this PR is minimal. No breaking changes are introduced.
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @pictos !
@germancoines why do you implemented 7956 and 7956_1 tests? They look like the same thing. Am I missing something here? Other than that your code fixed the issue. @PureWeen can you take a look at this one? |
Hi @pictos, @PureWeen . I just did it to check that the events (declared on XAML) were firing on both SearchHandler as well as inheriting classes . May be this wasn't needed at all, but I just wanted to double check that, as it seems to be a common use case scenario for developers. See this comment I left on the Issue: #7956 (comment) |
Thanks @jsuarezruiz |
@germancoines I don't have permissions on this repo. So if Javier approved it's good to be merged (: Thanks for your contribution ❣️ |
Hey @germancoines thank you so much for your patience here. And @pictos thanks for helping out here as well! If this is still of interest to you, could you confirm this is still an issue with the current stable version of Forms? I know there have been some changes in this area, and just want to confirm that this hasn't been fixed by another PR. Thanks! |
Hi @jfversluis , I'll be checking this as soon as I can to be back with the results for your request :) |
Hi @jfversluis, is there any update on this after my previous confirmation? |
@germancoines unfortunately not. So what you are basically saying is this change still needs to happen, right? |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Yes @jfversluis. Not sure about the failing test results for OSX and Windows on the pipeline. Is that usual? |
/azp run |
Commenter does not have sufficient privileges for PR 14375 in repo xamarin/Xamarin.Forms |
Hi @jfversluis @jsuarezruiz, I was willing to run the pipeline again in order to check the Build errors. Would it be possible to relaunch the pipeline, please? |
Now that we're so close to the sunsetting of Xamarin.Forms unfortunately we won't be able to take this in anymore, we're really sorry about that. Nevertheless, thank you so much for your time and effort that you have put into this PR. Please have a look at the evolution of Xamarin.Forms, .NET MAUI. A lot of development has been going on there. Hopefully this issue was already fixed in that codebase. If not, feel free to port this over to there. Again, thank you so much for being a contributor and Xamarin.Forms user! |
Description of Change
This pull request modifies the ShellSearchView class in order to actually trigger the SearchHandler OnFocused() and OnUnfocused() overridable methods as well as the Focused and Unfocused EventHandlers (disregarding if they were declared on XAML or in the CodeBehind) whenever the TextBox within the SearchHandler changes its focus state.
It also adds the Github Issues tests 7956 and 7956_1, in order to properly test such triggering of events.
The original commit that introduced the issue was e231882 . After having analised the code, my guess is that such commit intended to implement most of the features already existing within the VisualElement class by replicating parts of its code within the SearchHandler class (rather than by extending it, as many other controls do either directly or indirectly).
The mentioned commit ammended existing test cases based on the SearchHandlerPage and StorePages in order to test properties like BackgroundColor, CancelButtonColor, TextColor, PlaceholderColor, HorizontalTextAlignment, Keyboard, FontFamily, etc. but in none of them it tests that the Focused or Unfocused event handlers trigger.
Issues Resolved
API Changes
Added:
Changed:
Removed:
None.
Platforms Affected
Behavioral/Visual Changes
In case a SearchHandler (or an inheriting class) is declared within XAML providing Focused and/or Unfocused EventHandler functions, upgrading to this version will result in such events to actually trigger.
Before/After Screenshots
Before: The SearchHandler.cs Focused and/or Unfocused overridable functions nor the Focused and/or Unfocused EventHandlers (no matter if declared in XAML or CodeBehind) wouldn't trigger. Actions within the event handlers wouldn't take place (in this test, the labels contents wouldn't be shown).
After:
The SearchHandler.cs Focused and/or Unfocused overridable functions and the Focused and/or Unfocused EventHandlers (no matter if declared in XAML or CodeBehind) trigger. Actions within the event handlers take place (in this test, the labels contents are shown)
Issue7956.xaml - Focus
Issue7956.xaml - Unfocus
Issue7956_1.xaml - Focus
Issue7956_1.xaml - Unfocus
Testing Procedure
If steps 5 or 6 produce the mentioned output, the test would have passed. Otherwise, it would have failed.
PR Checklist