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

Scale widget size with system Text Size #2723

Merged
merged 4 commits into from
Apr 25, 2024
Merged

Conversation

krschau
Copy link
Collaborator

@krschau krschau commented Apr 22, 2024

Summary of the pull request

There are a few accessibility bugs around text being cut off inside widgets when system text scaling is turned up (Windows Settings > Accessibility > Text size). The Windows Widget Board (🪟+w) scales up the entire widget to match the text scaling, so we will, too. For example, the normal widget width is 300 pixels. If text scaling is at 200%, our widgets will become 600 px wide. Height also scales.
image

References and relevant issues

https://task.ms/49360547
https://task.ms/49658528

Detailed description of the pull request / Additional comments

  • WidgetControl and WidgetBoard both need to listen for text scale changed events and respond.
  • Widget header (icon, title, "more options" menu" also scales up.
  • Updating widget sizes must be done on the UI thread.
  • GetPixelHeightFromWidgetSize moves to WidgetControl since that is the only place it is used.

Validation steps performed

PR checklist

@krschau krschau marked this pull request as ready for review April 22, 2024 21:54
@krschau krschau added the Needs-Second Pull request that needs another approval label Apr 23, 2024
private SelectableMenuFlyoutItem _currentSelectedSize;

[ObservableProperty]
private GridLength _headerHeight;
Copy link
Contributor

Choose a reason for hiding this comment

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

Technically, these attributes should only be in ViewModels because the view should have no logic besides showing the view.

However, these members control the view and make the view simpler to understand.

I don't know when too much spillover of [ObservableProperty] into the view is too much.

But. I'm not blocking on this. Just a though.

WidgetHeight = GetPixelHeightFromWidgetSize(WidgetSource.WidgetSize) * textScale;
WidgetWidth = WidgetHelpers.WidgetPxWidth * textScale;
}

private async void OpenWidgetMenuAsync(object sender, RoutedEventArgs e)
{
if (sender as Button is Button widgetMenuButton)
Copy link
Contributor

Choose a reason for hiding this comment

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

sender as button widgetMenuButton would work here, ya?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think this way protects against the null case. And if (sender as Button widgetMenuButton) doesn't work because it doesn't evaluate to a boolean.

@krschau krschau merged commit 3c001c6 into main Apr 25, 2024
4 checks passed
@krschau krschau deleted the user/krschau/widget-scaling branch April 30, 2024 16:33
@krschau krschau removed the Needs-Second Pull request that needs another approval label May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow Dashboard widets to scale up in size with system text size
3 participants