Skip to content

Avoid changing native view in TextChanged, trigger TextChanging more reliably - #11231

Merged
MartinZikmund merged 3 commits into
masterfrom
dev/mazi/textchanged-fix
Feb 8, 2023
Merged

MartinZikmund merged 3 commits into
masterfrom
dev/mazi/textchanged-fix

Conversation

@MartinZikmund

@MartinZikmund MartinZikmund commented Feb 7, 2023 •

Copy link
Copy Markdown
Member

GitHub Issue (If applicable): closes #6289

PR Type

What kind of change does this PR introduce?

  • Bugfix

What is the current behavior?

What is the new behavior?

PR Checklist

Please check if your PR fulfills the following requirements:

Other information

Internal Issue (If applicable):

Fixes #6289 by removing text native TextBoxView text changes after TextChanged event is raised. This is problematic as it could cause race conditions in case the native view text changes but didn't have yet time to notify the managed code (this occurs for example on GTK).
@github-actions github-actions Bot added the area/skia ✏️ Categorizes an issue or PR as relevant to Skia label Feb 7, 2023

@Youssef1313 Youssef1313 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!! ❤️

…r modifies

Previously changes made to Text during TextChanged were "ignored", and TextChanging event and subsequent TextChanged events were not raised. Now any change performed in a TextChanged handler will trigger another round of TextChanging + TextChanged events.
@MartinZikmund MartinZikmund changed the title Avoid changing native view in TextChanged Avoid changing native view in TextChanged, trigger TextChanging more reliably Feb 7, 2023
@nventive-devops

Copy link
Copy Markdown
Contributor

The build 68626 found UI Test snapshots differences: android-28-xamarin: 36, android-28-xamarin-Snap: 66, ios: 34, ios-Snap: 108, macOS-screenshots: 25, skia-gtk-screenshots: 20, skia-wpf-screenshots: 17, wasm: 33, wasm-automated-net7.0-UWP-Benchmarks: 0, wasm-automated-net7.0-UWP-Default: 9, wasm-automated-net7.0-UWP-RuntimeTests: 0, wasm-automated-net7.0-WinUI-RuntimeTests: 0

Details
  • android-28-xamarin: 36 changed over 828

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • FocusManager_GetFocusedElement_HyperlinkButton_Validation_FocusManager_-_GetFocusedElement_-_HyperlinkButton_-_1_-_Initial_State
    • FocusManager_GetFocusedElement_HyperlinkButton_Validation_FocusManager_-_GetFocusedElement_-_HyperlinkButton_-_2_-_Click_outside
    • FocusManager_GetFocusedElement_ScrollViewer_Validation_FocusManager_-_GetFocusedElement_-_ScrollViewer_-_1_-_Initial_State
    • FocusManager_GetFocusedElement_ScrollViewer_Validation_FocusManager_-_GetFocusedElement_-_ScrollViewer_-_2_-_After_Selection
    • FocusManager_GetFocusedElement_ScrollViewer_Validation_Uno_UI_Samples_Content_UITests_FocusTests_FocusManager_GetFocus_Automated
    • ListView_ExpandableItemLarge_ExpandHeaderWithMultipleItems_Validation_Expanded_State
    • FocusManager_GetFocusedElement_TextBoxMultiLine_LostFocus_Validation_FocusManager_-_LostFocus_-_TextBoxMultiLine_-_2_-_Click_outside
    • FocusManager_GetFocusedElement_ToggleButton_LostFocus_Validation_Uno_UI_Samples_Content_UITests_FocusTests_FocusManager_GetFocus_Automated
    • ListView_ExpandableItem_ExpandMultipleItems_Expanded_State
    • FocusManager_GetFocusedElement_ComboBox_Validation_FocusManager_-_GetFocusedElement_-_ComboBox_-_1_-_Initial_State
    • FocusManager_GetFocusedElement_ComboBox_Validation_FocusManager_-_GetFocusedElement_-_ComboBox_-_2_-_After_Selection
    • FocusManager_GetFocusedElement_ComboBox_Validation_Uno_UI_Samples_Content_UITests_FocusTests_FocusManager_GetFocus_Automated
    • FocusManager_GetFocusedElement_HyperlinkButton_Validation_Uno_UI_Samples_Content_UITests_FocusTests_FocusManager_GetFocus_Automated
    • FocusManager_GetFocusedElement_TextBoxSingleLine_Validation_FocusManager_-_GetFocusedElement_-_TextBoxSingleLine_-_2_-_After_Selection
    • Keyboard_Textbox_NoScrollViewer_Validation_4_-_Remove_Focus_on_multilineTextBox
    • Check_ListView_Swallows_Measure_UITests_Shared_Windows_UI_Xaml_Controls_ListView_ListView_With_ListViews_Count_Measure
    • ContentDialog_Simple_NotLightDismissible_UITests_Shared_Windows_UI_Xaml_Controls_ContentDialogTests_ContentDialog_Simple
    • FlyoutTest_DataBoundButton_CommandExecutes_UITests_Shared_Windows_UI_Xaml_Controls_Flyout_Flyout_ButtonInContent
    • FocusManager_GetFocusedElement_TextBoxSingleLine_LostFocus_Validation_Uno_UI_Samples_Content_UITests_FocusTests_FocusManager_GetFocus_Automated
    • ProgressRing_Visibility_Collapsed_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
  • android-28-xamarin-Snap: 66 changed over 1018

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Brushes_ImageBrushAlignmentXY_Uno_UI_Samples_UITests_ImageBrushTestControl_ImageBrushAlignmentXY
    • Brushes_UITests_Windows_UI_Xaml_Media_BrushesTests_DynamicBrushes_On_Shapes_UITests_Windows_UI_Xaml_Media_BrushesTests_DynamicBrushes_On_Shapes
    • ColorPicker_ColorPickerSample_UITests_Microsoft_UI_Xaml_Controls_ColorPickerTests_ColorPickerSample
    • ColorPicker_WinUIColorPickerPage_UITests_Shared_Microsoft_UI_Xaml_Controls_ColorPickerTests_WinUIColorPickerPage
    • ComboBox_UITests_Shared_Windows_UI_Xaml_Controls_ComboBox_ComboBox_VisibleBounds_UITests_Shared_Windows_UI_Xaml_Controls_ComboBox_ComboBox_VisibleBounds
    • Default_UITests_Toolkit_ElevatedView_Levels_UITests_Toolkit_ElevatedView_Levels
    • Default_UITests_Toolkit_ElevatedView_Tester_UITests_Toolkit_ElevatedView_Tester
    • Clipping_SamplesApp_Windows_UI_Xaml_Clipping_XamlButtonWithClipping_Scrollable_SamplesApp_Windows_UI_Xaml_Clipping_XamlButtonWithClipping_Scrollable
    • Control_BasicEnability_UITests_Shared_Windows_UI_Xaml_Enability_BasicEnability
    • Gesture_Recognizer_UITests_Shared_Windows_UI_Input_GestureRecognizerTests_TappedTest_UITests_Shared_Windows_UI_Input_GestureRecognizerTests_TappedTest
    • Image_ImageSourceStream_Uno_UI_Samples_UITests_ImageTestsControl_ImageSourceStream
    • Image_UITests_Windows_UI_Xaml_Controls_ImageTests_SvgImageSource_Icons_UITests_Windows_UI_Xaml_Controls_ImageTests_SvgImageSource_Icons
    • ListView_ListViewHeaderImage_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewHeaderImage
    • Expander_WinUIExpanderPage_UITests_Shared_Microsoft_UI_Xaml_Controls_ExpanderTests_WinUIExpanderPage
    • Image_UITests_Windows_UI_Xaml_Controls_ImageTests_Image_Formats_UITests_Windows_UI_Xaml_Controls_ImageTests_Image_Formats
    • Image_Uno_UI_Samples_UITests_Image_Image_Stretch_Uno_UI_Samples_UITests_Image_Image_Stretch
    • Image_UITests_Shared_Windows_UI_Xaml_Controls_ImageTests_Image_Stretch_Algmnt_Inf_Horizontal_UITests_Shared_Windows_UI_Xaml_Controls_ImageTests_Image_Stretch_Algmnt_Inf_Horizontal
    • ListView_ListViewVariableHeightButton_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewVariableHeightButton
    • ListView_ListViewVariableHeightComplexTemplate_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewVariableHeightComplexTemplate
    • ListView_ListViewVariableItemHeightLong_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewVariableItemHeightLong
  • ios: 34 changed over 291

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Check_CornerRadius_Border_CornerRadius=5
    • ContentPresenter_Template_Uno_UI_Samples_Content_UITests_ContentPresenter_ContentPresenter_Template
    • Keyboard_Textbox_NoScrollViewer_Validation_4_-_Remove_Focus_on_multilineTextBox
    • Keyboard_Textbox_NoScrollViewer_Validation_5_-_Remove_Focus_on_numberTextBox
    • NativeCommandBar_Size_SecondOrientation
    • Screenshots_Image_Stretch_Alignment_Smaller_Mode-1
    • TextBox_BeforeTextChanging_Validation_UITests_Shared_Windows_UI_Xaml_Controls_TextBoxTests_TextBox_BeforeTextChanging
    • ThreeStates_Checked
    • ThreeStates_Indeterminate
    • ThreeStates_UITests_Shared_Windows_UI_Xaml_Controls_CheckBoxTests_CheckBox_Automated
    • ThreeStates_Unchecked
    • BasicExpressionTest_UITests_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBox_ExpressionTest
    • Check_CornerRadius_Border_No_CornerRadius
    • Keyboard_Textbox_NoScrollViewer_Validation_0_-_Remove_Focus_on_normalTextBox
    • Keyboard_Textbox_NoScrollViewer_Validation_1_-_Remove_Focus_on_filledTextBox
    • PasswordBox_RevealInScrollViewer_Uno_UI_Samples_Content_UITests_TextBoxControl_PasswordBox_Reveal_Scroll
    • ProgressRing_IsEnabled_Running_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • ProgressRing_Visibility_Collapsed_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • Screenshots_Image_Stretch_Alignment_Wider_Mode-2
    • Screenshots_Image_Stretch_Alignment_Wider_Mode-3
  • ios-Snap: 108 changed over 1009

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AutoSuggestBox_UITests_Windows_UI_Xaml_Controls_AutoSuggestBoxTests_AutoSuggestBox_Description_UITests_Windows_UI_Xaml_Controls_AutoSuggestBoxTests_AutoSuggestBox_Description
    • Brushes_ImageBrushWithRotateTransform_Uno_UI_Samples_UITests_ImageBrushTestControl_ImageBrushWithRotateTransform
    • Brushes_ImageBrushWithScaleTransform_Uno_UI_Samples_UITests_ImageBrushTestControl_ImageBrushWithScaleTransform
    • Buttons_AppBarToggleButtonTest_Uno_UI_Samples_Content_UITests_ButtonTestsControl_AppBarToggleButtonTest
    • Animations_UITests_Windows_UI_Xaml_Media_Animation_ColorAnimation_Background_UITests_Windows_UI_Xaml_Media_Animation_ColorAnimation_Background
    • AutoSuggestBox_UITests_Windows_UI_Xaml_Controls_AutoSuggestBoxTests_AutoSuggestBox_Reason_UITests_Windows_UI_Xaml_Controls_AutoSuggestBoxTests_AutoSuggestBox_Reason
    • Brushes_ImageBrushStretch_Uno_UI_Samples_UITests_ImageBrushTestControl_ImageBrushStretch
    • Brushes_UITests_Windows_UI_Xaml_Media_BrushesTests_SolidColorBrush_Color_Changed_UITests_Windows_UI_Xaml_Media_BrushesTests_SolidColorBrush_Color_Changed
    • Brushes_Uno_UI_Samples_UITests_ImageBrushTestControl_Ellipse_Uno_UI_Samples_UITests_ImageBrushTestControl_Ellipse
    • Animations_DoubleAnimation_TranslateX_GenericApp_Views_Content_UITests_Animations_DoubleAnimation_TranslateX
    • Border_Border_Simple_with_Opacity_Uno_UI_Samples_UITests_BorderTestsControl_Border_Simple_with_Opacity
    • Border_UITests_Shared_Windows_UI_Xaml_Controls_BorderTests_Border_CornerRadius_Toggle_UITests_Shared_Windows_UI_Xaml_Controls_BorderTests_Border_CornerRadius_Toggle
    • Brushes_ImageBrushWithLateSource_Uno_UI_Samples_UITests_ImageBrushTestControl_ImageBrushWithLateSource
    • Clipping_SamplesApp_Windows_UI_Xaml_Clipping_XamlButtonWithClipping_SamplesApp_Windows_UI_Xaml_Clipping_XamlButtonWithClipping
    • ComboBox_ComboBox_ItemsSource_SamplesApp_Wasm_Windows_UI_Xaml_Controls_ComboBox_ComboBox_ItemsSource
    • Border_Border_Corner_Overlap_UITests_Shared_Windows_UI_Xaml_Controls_BorderTests_Border_CornerOverlap
    • Border_NonUniformThicknessandRadius_Uno_UI_Samples_UITests_BorderTestsControl_NonUniformThicknessandRadius
    • Brushes_ImageBrushAlignmentXY_Uno_UI_Samples_UITests_ImageBrushTestControl_ImageBrushAlignmentXY
    • Brushes_Uno_UI_Samples_UITests_ImageBrushTestControl_DoubleImageBrushInList_Uno_UI_Samples_UITests_ImageBrushTestControl_DoubleImageBrushInList
    • Default_UITests_Toolkit_ElevatedView_Corners_UITests_Toolkit_ElevatedView_Corners
  • macOS-screenshots: 25 changed over 1087

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Image-Image_Stretch.png
    • Image-SvgImageSource_FromStream.png
    • Image-ImageSourceStream.png
    • Image-Image_Stretch_Alignment_Wider.png
    • Image-Image_Fixed_Size_Alignment.png
    • ListView-ListView_With_ListViews_Count_Measure.png
    • MediaPlayerElement-Using .3gp.png
    • MediaPlayerElement-Using .mkv.png
    • NavigationView-NavigationViewPage.png
    • NavigationView-NavigationViewTopNavPage.png
    • ListView-ListView_IsSelected.png
    • MUX-NavigationViewCustomThemeResourcesPage.png
    • MUX-NavigationViewPage.png
    • MUX-NavigationViewRS3Page.png
    • MUX-NavigationViewRS4Page.png
    • MUX-NavigationViewTopNavPage.png
    • MUX-TabViewPage.png
    • MUX-WinUIProgressRingPage.png
    • MUX-WinUIProgressRing_CustomSources.png
    • NavigationView-NavigationViewBasicPage.png
  • skia-gtk-screenshots: 20 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Brushes-ImageBrushChangingCornerRadius.png
    • Brushes-ImageBrush_StreamSource.png
    • DragAndDrop-DragDrop_TestPage.png
    • Image-Image_Stretch.png
    • MUX-TabViewBasicPage.png
    • MUX-TabViewItemsSourceTests.png
    • MUX-TabViewPage.png
    • MUX-WinUIProgressRingPage.png
    • MUX-WinUIProgressRing_CustomSources.png
    • Pickers-CalendarView_Theming.png
    • Progress-WindowsProgressRing_GH1220.png
    • Progress-WinUIProgressRingPage.png
    • Progress-WinUIProgressRing_CustomSources.png
    • Progress-WinUIProgressRing_Features.png
    • MUX-NavigationViewPage.png
    • MUX-NavigationViewTopNavOnlyPage.png
    • TabView-TabViewBasicPage.png
    • TabView-TabViewItemsSourceTests.png
    • TabView-TabViewPage.png
    • Transform-TransformToVisual_Translate2d.png
  • skia-wpf-screenshots: 17 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Automation-AutomationProperties_Name.png
    • DragAndDrop-DragDrop_TestPage.png
    • Image-UniformToFill100x100.png
    • Pickers-CalendarView_Theming.png
    • MUX-TabViewBasicPage.png
    • MUX-TabViewItemsSourceTests.png
    • MUX-TabViewPage.png
    • MUX-WinUIProgressRingPage.png
    • MUX-WinUIProgressRing_CustomSources.png
    • Progress-WindowsProgressRing_GH1220.png
    • Progress-WinUIProgressRingPage.png
    • Progress-WinUIProgressRing_CustomSources.png
    • Progress-WinUIProgressRing_Features.png
    • TabView-TabViewBasicPage.png
    • TabView-TabViewItemsSourceTests.png
    • TabView-TabViewPage.png
    • Transform-TransformToVisual_Translate2d.png
  • wasm: 33 changed over 1017

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • MUXControlsTestApp.PaneLayoutTestPage
    • SamplesApp.Samples.Windows_UI_Xaml_Controls.NavigationViewTests.NavigationView_BasicNavigation
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • MUXControlsTestApp.NavigationViewMenuItemStretchPage
    • MUXControlsTestApp.NavigationViewTopNavOnlyPage
    • SamplesApp.Samples.Windows_UI_Xaml_Controls.NavigationViewTests.NavigationView_Pane_Automated
    • MUXControlsTestApp.NavigationViewMinimalPage
    • MUXControlsTestApp.PipsPagerExamples
    • SamplesApp.Samples.NavigationViewSample.NavigationViewSample
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewVariableHeightComplexTemplate
    • UITests.Microsoft_UI_Xaml_Controls.ProgressRing.WinUIProgressRingPage
    • UITests.Microsoft_UI_Xaml_Controls.ProgressRing.WinUIProgressRing_CustomSources
    • UITests.Microsoft_UI_Xaml_Controls.ProgressRing.WinUIProgressRing_Features
    • UITests.Microsoft_UI_Xaml_Controls.NavigationViewTests.NavigationViewBasicPage
    • UITests.Microsoft_UI_Xaml_Controls.TabViewTests.TabViewItemsSourceTests
    • UITests.Microsoft_UI_Xaml_Controls.TabViewTests.TabViewPage
    • UITests.Microsoft_UI_Xaml_Controls.TabViewTests.TabViewBasicPage
    • UITests.Shared.Windows_UI_Xaml_Controls.ListView.ListView_TransformsOnList
    • UITests.Shared.Windows_UI_Xaml_Controls.ListView.ListView_With_ListViews_Count_Measure
    • UITests.Windows_UI_ViewManagement.ApplicationViewSizing
  • wasm-automated-net7.0-UWP-Benchmarks: 0 changed over 1

  • wasm-automated-net7.0-UWP-Default: 9 changed over 887

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ImageStretch_None_Uno_UI_Samples_UITests_ImageTestsControl_Image_Stretch_None
    • NativeCommandBar_Size_Uno_UI_Samples_Content_UITests_CommandBar_CommandBar_Dynamic
    • MinMaxTest_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
    • SelectionContentTest_UITests_Microsoft_UI_Xaml_Controls_TabViewTests_TabViewItemsSourceTests
    • SelectionTest_UITests_Microsoft_UI_Xaml_Controls_RadioButtonsTests_RadioButtonsPage
    • SequentialAnimations_SamplesApp_Windows_UI_Xaml_Media_Animation_SequentialAnimationsPage
    • TestProgressRing_InitialState_UITests_Microsoft_UI_Xaml_Controls_ProgressRing_WinUIProgressRing_Features
    • When_Theme_Changed_No_Crash_UITests_Windows_UI_Xaml_Controls_CalendarView_CalendarView_Theming
    • When_TransformToVisual_ScrollViewer_UITests_Shared_Windows_UI_Xaml_UIElementTests_TransformToVisual_ScrollViewer
  • wasm-automated-net7.0-UWP-RuntimeTests: 0 changed over 1

  • wasm-automated-net7.0-WinUI-RuntimeTests: 0 changed over 1

@MartinZikmund
MartinZikmund merged commit 69cf2b0 into master Feb 8, 2023
@MartinZikmund
MartinZikmund deleted the dev/mazi/textchanged-fix branch February 8, 2023 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/skia ✏️ Categorizes an issue or PR as relevant to Skia

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Skia.Gtk Textbox issue: caret position resets while typing and flickering on hovering

4 participants