Describe the bug
The selected text highlight disappears most of the time after right clicking it. This applies to:
Steps to reproduce the bug
NOTE: It doesn't always happen on the first right-click, but simply right-click again on the text without closing the context menu and it will typically disappear then.
Expected behavior
The selected text highlight should remain visible until the selected text is no longer selected.
Contrast this behavior to right-clicking text in OneNote; you can right-click selected text there as many times as you like and whatever was selected will keep its highlight the whole time.
Version Info
XAML Controls Gallery v.1.2.11.0
NuGet package version:
| Windows 10 version | Saw the problem? |
| :--------------------------------- | :-------------------- |
| Insider Build (xxxxx) | |
| May 2019 Update (18362) | Yes |
| October 2018 Update (17763) | |
| April 2018 Update (17134) | |
| Fall Creators Update (16299) | |
| Creators Update (15063) | |
| Device form factor | Saw the problem? |
| :-------------------- | :------------------- |
| Desktop | Yes/No? |
| Mobile | |
| Xbox | |
| Surface Hub | |
| IoT | |
I see this on controls gallery as well.
I had this issue in one of my apps and I worked around it by setting SelectionHighlightColorWhenNotFocused
, I hope this helps 馃檪
<TextBox>
<TextBox.SelectionHighlightColorWhenNotFocused>
<SolidColorBrush Color="{StaticResource SystemAccentColor}"/>
</TextBox.SelectionHighlightColorWhenNotFocused>
</TextBox>
@yaichenbaum
Using SelectionHighlightColorWhenNotFocused
is just a workaround rather than a fix, as now the expected behavior that the selection color change when the app or TextBox loses focus is gone.
Popping a context menu for selected text shouldn't cause the text to lose focus. Or if it has to lose focus, then there needs to be logic or a new property to handle this scenario (although that property would/should be equal to SelectionHighlightColor
by default).
I can also repro. It does just seem to be the visual state; selection state restores when the menu closes. Given the workaround above it does seem like focus is getting lost/restored.
@ddalp (Text) and @Austin-Lamb (Focus): Does this at all sound familiar (TextBox losing focus while context menu is up)?
@chrisglein It is a bug. @marlenecota had to fake the focus still on Text Control while floatie is shown. This looks like another case we did not handle the fake focus well.