-
Notifications
You must be signed in to change notification settings - Fork 749
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14983 from ramezgerges/wasm_autosuggestbox_focus
fix(textbox): fix textbox losing focus on WASM if alt-tabbed out then back in
- Loading branch information
Showing
4 changed files
with
89 additions
and
24 deletions.
There are no files selected for viewing
This file contains 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
24 changes: 24 additions & 0 deletions
24
src/SamplesApp/UITests.Shared/Windows_UI_Xaml/FocusManager/Focus_WASM_Tab.xaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<UserControl x:Class="Uno.UI.Samples.Content.UITests.FocusTests.Focus_WASM_Tab" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable=""> | ||
<StackPanel> | ||
<TextBlock> | ||
Focus the address bar then tab into the page. SplitView should be focused and not RootVisual. | ||
</TextBlock> | ||
<StackPanel VerticalAlignment="Center"> | ||
<TextBlock Text="Currently focused control" | ||
FontSize="22" /> | ||
<Border Background="LightGray" | ||
Margin="0,8,0,0"> | ||
<TextBlock x:Name="TxtCurrentFocused" | ||
Text="<none>" | ||
FontSize="18" | ||
FontWeight="Bold" | ||
TextAlignment="Center" | ||
Margin="0,6" /> | ||
</Border> | ||
</StackPanel> | ||
</StackPanel> | ||
</UserControl> |
22 changes: 22 additions & 0 deletions
22
src/SamplesApp/UITests.Shared/Windows_UI_Xaml/FocusManager/Focus_WASM_Tab.xaml.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Uno.UI.Samples.Controls; | ||
using Microsoft.UI.Xaml; | ||
using Microsoft.UI.Xaml.Controls; | ||
|
||
namespace Uno.UI.Samples.Content.UITests.FocusTests | ||
{ | ||
[Sample("Focus", IsManualTest = true)] | ||
public sealed partial class Focus_WASM_Tab : UserControl | ||
{ | ||
public Focus_WASM_Tab() | ||
{ | ||
this.InitializeComponent(); | ||
|
||
Microsoft.UI.Xaml.Input.FocusManager.GotFocus += FocusManager_GotFocus; | ||
} | ||
|
||
private void FocusManager_GotFocus(object sender, Microsoft.UI.Xaml.Input.FocusManagerGotFocusEventArgs e) | ||
{ | ||
this.TxtCurrentFocused.Text = (e.NewFocusedElement as FrameworkElement)?.Name ?? "<none>"; | ||
} | ||
} | ||
} |
This file contains 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