microsoft-ui-xaml icon indicating copy to clipboard operation
microsoft-ui-xaml copied to clipboard

`BreadcrumbBar` `MoveFocus` method should not use parameterless `GetFocusedElement`

Open MartinZikmund opened this issue 8 months ago • 2 comments

Describe the bug

The code currently uses GetFocusedElement without XamlRoot parameter, which always returns null in WinUI

Steps to reproduce the bug

See the BreadcrumbBar.cpp

Expected behavior

GetFocusedElement(XamlRoot) should be used

Screenshots

No response

NuGet package version

None

Windows version

No response

Additional context

No response

MartinZikmund avatar Apr 17 '25 09:04 MartinZikmund

@MartinZikmund thanks for pointing it out and creating an issue, have you seen any unexpected behavior ~ a crash or UI glitch with BreadcrumbBar due to incorrect usage of GetFocusedElement?

Hemantxk avatar Jun 05 '25 09:06 Hemantxk

@Hemantxk not necessarily, just the current behavior essentially means that the whole branch is "dead" code, which will never be executed; so if the code was there for a specific use case, it will not work correctly. I noticed this issue when porting the control to Uno Platform where I adjusted it to use the XamlRoot:

Image

MartinZikmund avatar Jun 05 '25 11:06 MartinZikmund

Looks like it closed mistakenly. Reopening.

Hemantxk avatar Jun 27 '25 09:06 Hemantxk