Skip to content
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

[Skia] The focus visual is not being clipped when it should in some cases. #18319

Open
ramezgerges opened this issue Sep 27, 2024 · 1 comment
Labels
difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working project/layout 🧱 Categorizes an issue or PR as relevant to layouting and containers (Measure/Arrange, Collections,..) triage/untriaged Indicates an issue requires triaging or verification

Comments

@ramezgerges
Copy link
Contributor

Current behavior

Currently, the focus visual is only clipped by things like scrolling. There are edge cases where the focus visual should be clipped but it doesn't. These cases are when the element of the focus visual is being partially covered by another element in a Panel (e.g. a Grid or a Canvas).
WinUI
image
Uno
image

Surprisingly, WinUI doesn't clip the focus visual if the focused element and the element that partially covers it are direct siblings inside the panel. In other words, the following snippet on WinUI behaves like the Uno image above.

<Grid Height="110">
       <ContentControl Content="TabToMe" VerticalAlignment="Top" UseSystemFocusVisuals="true" />
       <Border Background="Green" Height="100" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" />
</Grid>

But, if you wrap the focus element in anything (e.g. a UserControl), WinUI clips and Uno doesn't.

<Grid Height="110">
      <UserControl>
             <ContentControl Content="TabToMe" VerticalAlignment="Top" UseSystemFocusVisuals="true" />
       </UserControl>
       <Border Background="Green" Height="100" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" />
</Grid>

Expected behavior

No response

How to reproduce it (as minimally and precisely as possible)

<Grid Height="110">
      <ContentPresenter>
             <ContentControl Content="TabToMe" VerticalAlignment="Top" UseSystemFocusVisuals="true" />
       </ContentPresenter>
       <Border Background="Green" Height="100" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" />
</Grid>

Similarly:

<Canvas Height="110">
      <UserControl>
            <ContentControl Content="TabToMe" VerticalAlignment="Top" UseSystemFocusVisuals="true" />
      </UserControl>
      <Border Canvas.Top="10" Background="Green" Height="100" Width="100" />
</Canvas>

Workaround

No response

Works on UWP/WinUI

None

Environment

No response

NuGet package version(s)

No response

Affected platforms

No response

IDE

No response

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

No response

@ramezgerges ramezgerges added kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. labels Sep 27, 2024
@MartinZikmund
Copy link
Member

The clipping is incorrect in non-Skia targets as well, but it is definitely going to be more complex to fix there

@Youssef1313 Youssef1313 added the project/layout 🧱 Categorizes an issue or PR as relevant to layouting and containers (Measure/Arrange, Collections,..) label Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working project/layout 🧱 Categorizes an issue or PR as relevant to layouting and containers (Measure/Arrange, Collections,..) triage/untriaged Indicates an issue requires triaging or verification
Projects
None yet
Development

No branches or pull requests

3 participants