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

[Registry Preview] Update all AppBarButtons to use an explicit AppBarButton.Icon (Fix for 27766) #27770

Merged
merged 2 commits into from
Aug 8, 2023

Conversation

randyrants
Copy link
Collaborator

Summary of the Pull Request

A recent update of awesomeness came through this app, cleaning up the UI in various ways, which is amazing. However, a bug may have snuck back into the code around the icons used in the commandbar in various languages; this brings the fix back into the code.

PR Checklist

Detailed Description of the Pull Request / Additional comments

In the XAML file, I've removed all references to Icon="Name" and replaced it with a corresponding FontIcon; I also added an explicit FontFamily to the FontIcon to avoid issues across Windows versions and languages, per the "best practices" called out in the WinUI 3 documentation.

Validation Steps Performed

Visually verified the UI:
image

Removes the Icon property from all AppBarButtons and adds FontFamily for all Glyph's
@randyrants randyrants added the Product-Registry Preview Refers to the Registry Preview PowerToy label Aug 2, 2023
@randyrants randyrants mentioned this pull request Aug 2, 2023
11 tasks
@@ -95,7 +95,7 @@
x:Uid="OpenButton"
Click="OpenButton_Click">
<AppBarButton.Icon>
<FontIcon Glyph="&#xe8e5;"/>
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="&#xe8e5;"/>
Copy link
Collaborator

@Jay-o-Way Jay-o-Way Aug 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't hurt to declare it, but it's default and thus redundant.
See https://learn.microsoft.com/nl-nl/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.controls.fonticon?view=windows-app-sdk-1.2#default-font-family

To use glyphs from the default system font, don't set the FontFamily property, let it use its default value.

Copy link
Collaborator Author

@randyrants randyrants Aug 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I keep going back to this from when I made the change, regardless of what the docs tell us:

"I agree it should, but the fallback behavior with zh-Hans hasn't, well, fallen back as it should. On Win11, it should use Segoe Fluent Icons, but on Win10 it should look for Segou MDL2 Assets, and if Windows 8 was supported, it should look for Segoe UI Symbol. For LIXiangChen, Windows 10 with Simplified Chinese, the original code picked up an unexpected font for the icon, which is the oddity. My hope is that by calling out the StaticResource explicitly, it will behave better."

I'll think it's better to have it.

@@ -114,9 +116,11 @@
<AppBarButton
x:Name="saveButton"
x:Uid="SaveButton"
Icon="Save"
Copy link
Collaborator

@Jay-o-Way Jay-o-Way Aug 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I know that the SymbolIcon element is bad, but looks like the Appbar icon leverages the same thing. 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completely agree, if the fallback logic for all the OS's and all the languages worked. It started using the Icon property and only went the more pedantic route after the bug for Win 10 in traditional Chinese was reported.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I was thinking of was more the glyphs it uses; all in E1** range

Copy link
Collaborator

@Jay-o-Way Jay-o-Way left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally don't feel an urgency to put those icons back, but I won't hold this back either.

@randyrants
Copy link
Collaborator Author

I personally don't feel an urgency to put those icons back, but I won't hold this back either.
I agree: wouldn't have bothered at all if it wasn't for the chance that some languages and some OS versions would get bad behavior.

No ask for a hotfix but getting it out there with 0.73.0 should be good.

Copy link
Collaborator

@jaimecbernardo jaimecbernardo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you for the contribution!
Only change required is that one of the icons doesn't appear on Windows 10 (gets replaced with a rectangle since it's a symbol not found).

Removing a "Windows 11-only" glyph to prevent UI issues.
Copy link
Collaborator

@jaimecbernardo jaimecbernardo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you for the contribution!

@jaimecbernardo jaimecbernardo merged commit f6e9b08 into microsoft:main Aug 8, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Product-Registry Preview Refers to the Registry Preview PowerToy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants