-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix CommandPalette to prefer inner interactions over bindings #9056
Changes from all commits
54c2060
20e2682
698aa10
f6ada94
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,6 @@ the MIT License. See LICENSE in the project root for license information. --> | |
AllowFocusOnInteraction="True" | ||
PointerPressed="_rootPointerPressed" | ||
PreviewKeyDown="_previewKeyDownHandler" | ||
KeyDown="_keyDownHandler" | ||
PreviewKeyUp="_keyUpHandler" | ||
LostFocus="_lostFocusHandler" | ||
mc:Ignorable="d" | ||
|
@@ -47,13 +46,13 @@ the MIT License. See LICENSE in the project root for license information. --> | |
|
||
<Grid HorizontalAlignment="Stretch" ColumnSpacing="8" > | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="16"/> | ||
<ColumnDefinition Width="16"/> | ||
<!-- icon --> | ||
<ColumnDefinition Width="Auto"/> | ||
<ColumnDefinition Width="Auto"/> | ||
<!-- command label --> | ||
<ColumnDefinition Width="*"/> | ||
<ColumnDefinition Width="*"/> | ||
<!-- key chord --> | ||
<ColumnDefinition Width="16"/> | ||
<ColumnDefinition Width="16"/> | ||
<!-- gutter for scrollbar --> | ||
</Grid.ColumnDefinitions> | ||
|
||
|
@@ -119,15 +118,15 @@ the MIT License. See LICENSE in the project root for license information. --> | |
|
||
<Grid HorizontalAlignment="Stretch" ColumnSpacing="8" > | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="16"/> | ||
<ColumnDefinition Width="16"/> | ||
<!-- icon / progress --> | ||
<ColumnDefinition Width="Auto"/> | ||
<ColumnDefinition Width="Auto"/> | ||
<!-- command label --> | ||
<ColumnDefinition Width="*"/> | ||
<ColumnDefinition Width="*"/> | ||
<!-- gutter for indicators --> | ||
<ColumnDefinition Width="Auto"/> | ||
<!-- Indicators --> | ||
<ColumnDefinition Width="16"/> | ||
<ColumnDefinition Width="16"/> | ||
<!-- gutter for scrollbar --> | ||
</Grid.ColumnDefinitions> | ||
|
||
|
@@ -160,12 +159,12 @@ the MIT License. See LICENSE in the project root for license information. --> | |
VerticalAlignment="Center" | ||
HorizontalAlignment="Right" | ||
Orientation="Horizontal"> | ||
<FontIcon | ||
FontFamily="Segoe MDL2 Assets" | ||
Visibility="{x:Bind Item.(local:TabPaletteItem.TabStatus).BellIndicator, Mode=OneWay}" | ||
Glyph="" | ||
FontSize="12" | ||
|
||
<FontIcon | ||
FontFamily="Segoe MDL2 Assets" | ||
Visibility="{x:Bind Item.(local:TabPaletteItem.TabStatus).BellIndicator, Mode=OneWay}" | ||
Glyph="" | ||
FontSize="12" | ||
Margin="0,0,8,0"/> | ||
|
||
<FontIcon | ||
|
@@ -187,7 +186,7 @@ the MIT License. See LICENSE in the project root for license information. --> | |
</ListViewItem> | ||
</DataTemplate> | ||
|
||
<local:PaletteItemTemplateSelector x:Key="PaletteItemTemplateSelector" TabItemTemplate="{StaticResource TabItemTemplate}" GeneralItemTemplate="{StaticResource GeneralItemTemplate}"/> | ||
<local:PaletteItemTemplateSelector x:Key="PaletteItemTemplateSelector" TabItemTemplate="{StaticResource TabItemTemplate}" GeneralItemTemplate="{StaticResource GeneralItemTemplate}"/> | ||
|
||
<ResourceDictionary.ThemeDictionaries> | ||
<ResourceDictionary x:Key="Dark"> | ||
|
@@ -431,7 +430,6 @@ the MIT License. See LICENSE in the project root for license information. --> | |
AllowDrop="False" | ||
IsItemClickEnabled="True" | ||
ItemClick="_listItemClicked" | ||
PreviewKeyDown="_keyDownHandler" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just double-checking. So if we have focus on a list view item, any key stroke we make will go to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Actually Preview is going top down... and if the key is handled by the _keyDownHandler the propagation stops. In other words, this line was doing nothing functional (because if the handler handles the event, the propagation would stop on the palette level, and if the handler does not - there is no need to propagate) 😄 |
||
ItemsSource="{x:Bind FilteredActions}" | ||
ItemTemplateSelector="{StaticResource PaletteItemTemplateSelector}"> | ||
</ListView> | ||
|
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.
Should we also hardcode some other text box default bindings like ctrl+a, ctrl+left/right, ctrl+x, and home/end? Or what makes ctrl+c and ctrl+v so special here?
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.
Isn't there a way to ask the text box to handle the event first, and if it can't then we handle it? Or how does the order of handling work?
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.
Yes. Probably. I handled copy and paste explicitly as right now it is the same default binding for pasting in the terminal. Which means that the current behavior upon ctrl+v is to paste in the terminal.