@@ -127,4 +127,49 @@ async Task AssertMenu(string menuHeader)
127
127
Assert . True ( menuItem is not null , $ "{ menuHeader } menu item not found") ;
128
128
}
129
129
}
130
- }
130
+
131
+ [ Fact ]
132
+ [ Description ( "Issue 2713" ) ]
133
+ public async Task OnEditableComboBox_ClickInTextArea_FocusesTextBox ( )
134
+ {
135
+ await using var recorder = new TestRecorder ( App ) ;
136
+
137
+ var stackPanel = await LoadXaml < StackPanel > ( @"
138
+ <StackPanel Orientation=""Horizontal"">
139
+ <ComboBox x:Name=""EditableComboBox"" IsEditable=""True"" Style=""{StaticResource MaterialDesignComboBox}"">
140
+ <ComboBoxItem>Select1</ComboBoxItem>
141
+ <ComboBoxItem>Select2</ComboBoxItem>
142
+ <ComboBoxItem IsSelected=""True"">Select3</ComboBoxItem>
143
+ <ComboBoxItem>Select4</ComboBoxItem>
144
+ <ComboBoxItem>Select5</ComboBoxItem>
145
+ </ComboBox>
146
+ <Button x:Name=""Button"" />
147
+ </StackPanel>" ) ;
148
+
149
+ var comboBox = await stackPanel . GetElement < ComboBox > ( "EditableComboBox" ) ;
150
+ var editableTextBox = await comboBox . GetElement < TextBox > ( "PART_EditableTextBox" ) ;
151
+ var button = await stackPanel . GetElement < Button > ( "Button" ) ;
152
+
153
+ // Open the combobox initially
154
+ await comboBox . LeftClick ( Position . RightCenter ) ;
155
+ await Task . Delay ( 50 ) ; // Allow a little time for the drop-down to open (and property to change)
156
+ bool wasOpenAfterClickOnToggleButton = await comboBox . GetIsDropDownOpen ( ) ;
157
+
158
+ // Focus (i.e. click) another element
159
+ await button . LeftClick ( ) ;
160
+
161
+ // Click the editable TextBox of the ComboBox
162
+ await editableTextBox . LeftClick ( ) ;
163
+ await Task . Delay ( 50 ) ; // Allow a little time for the drop-down to open (and property to change)
164
+ bool wasOpenAfterClickOnEditableTextBox = await comboBox . GetIsDropDownOpen ( ) ;
165
+ bool textBoxHasFocus = await editableTextBox . GetIsFocused ( ) ;
166
+ bool textBoxHasKeyboardFocus = await editableTextBox . GetIsKeyboardFocused ( ) ;
167
+
168
+ Assert . True ( wasOpenAfterClickOnToggleButton , "ComboBox should have opened drop down when clicking the toggle button" ) ;
169
+ Assert . False ( wasOpenAfterClickOnEditableTextBox , "ComboBox should not have opened drop down when clicking the editable TextBox" ) ;
170
+ Assert . True ( textBoxHasFocus , "Editable TextBox should have focus" ) ;
171
+ Assert . True ( textBoxHasKeyboardFocus , "Editable TextBox should have keyboard focus" ) ;
172
+
173
+ recorder . Success ( ) ;
174
+ }
175
+ }
0 commit comments