microsoft / microsoft-ui-xaml

WinUI: a modern UI framework with a rich set of controls and styles to build dynamic and high-performing Windows applications.
MIT License
6.38k stars 683 forks source link

TextCommandBarFlyout does not position correctly when TextBox is towards bottom of screen #5813

Open lyahdav opened 3 years ago

lyahdav commented 3 years ago

Describe the bug

TextCommandBarFlyout does not position correctly when TextBox is towards bottom of screen.

Steps to reproduce the bug

Steps to reproduce the behavior:

  1. Run XAML Controls Gallery app
  2. Go to TextBox example
  3. Resize window and scroll so that a TextBox is towards bottom of screen
  4. Type "test test" in TextBox
  5. Right click second "test"

Expected behavior Expected: TextCommandBarFlyout opens in correct position. Actual: TextCommandBarFlyout opens in wrong position.

Screenshots image

Version Info I'm on version 1.2.20.0 of XAML Controls Gallery.

Windows version Saw the problem?
Insider Build (xxxxx)
May 2021 Update (19043) Yes
October 2020 Update (19042)
May 2020 Update (19041)
November 2019 Update (18363)
May 2019 Update (18362)
October 2018 Update (17763)
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes
Xbox
Surface Hub
IoT

Additional context I also confirmed this issue happens when using TextCommandBarFlyout from WinUI version 2.7.0-prerelease.210816001 both in UWP app and in Islands app. Here's an example project demonstrating that: https://github.com/lyahdav/XamlPlayground/tree/text-box-with-win-ui-2-cbf

eugenegff commented 3 years ago

I think the reason is the same as in https://github.com/microsoft/microsoft-ui-xaml/issues/5833 - never yet shown AppBarButtons in secondary commands are measured wrong. You can try the workaround from https://github.com/microsoft/microsoft-ui-xaml/issues/5833 till the underlying issue would be fixed in MUX

StephenLPeters commented 3 years ago

@lyahdav and @eugenegff this issues is very familiar and I think actually fixed, however in the system xaml code that shipped with the one of the WindowsInsiderProgram builds of Windows 11. Do either of you have the ability to check if your repro happens on a windows 11 device?

lyahdav commented 3 years ago

@StephenLPeters I just confirmed on Windows 11 21H2 (OS Build 22000.120) the issue is fixed! I attempted repro in XAML Controls Gallery app. Are there plans to add a workaround in WinUI 2?

eugenegff commented 3 years ago

Windows 11, 10.0.22000.184 - problem still exist, screenshots and details regarding reproducibility are in #5833

lyahdav commented 3 years ago

@eugenegff maybe this means that #5833 is a different bug since I couldn't repro on an older Windows 11 build than you tested?

eugenegff commented 3 years ago

@eugenegff maybe this means that #5833 is a different bug since I couldn't repro on an older Windows 11 build than you tested?

I think that the underlying bug - is wrong measure of AppBarButton items that would be used as secondary commands in CommandBarFlyout, and the code inside CommandBarFlyout that relies on results of wrong measure. If your case could be fixed using MeasureOverride workaround from #5833 on Windows 10 - it is the same bug.

I wonder what changed in Windows 11 - as measured size of AppBarButton is still wrong. Some subtle animation on screen hints that may be Popup after layouting and resizing to proper smaller size probably realign itself to calculated bottom border of the too large measured rect - but it seems to be unreliable, as bug still could be reproduced in some cases on Win11.

The worst is that seems that it depends on styles, so while now frequency is lowered - it could go high again with seemingly innocent change in styling.

StephenLPeters commented 3 years ago

@llongley what was the nature of the system xaml change that "fixed" this issue in windows 11? Is it possible we missed some cases?

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days.

lyahdav commented 1 year ago

Based on comments above this should probably still stay open