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

Windows title bar size not changing when text size is changed for accessibility reasons #23980

Open
akedves opened this issue Aug 2, 2024 · 2 comments
Assignees
Labels
area-controls-titlebar platform/windows 🪟 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@akedves
Copy link

akedves commented Aug 2, 2024

Description

I’m working on a MAUI application for Windows and I’m trying to set the top padding of a UI element so it does not overlap the titlebar. I’ve written a function to calculate the required padding on top, which I’ll provide below. The problem arises when I change the text size setting in Windows for accessibility reasons. While the default title bar of other applications adjusts correctly, the MAUI application’s title bar does not change in the same way. My function returns the correct height that matches the required padding for any default window other than the MAUI application.

My code for calculating the titlebar height

[DllImport("uxtheme.dll", CharSet = CharSet.Auto)]
public static extern int GetThemeSysSize(IntPtr hTheme, int iSizeId);
public const int SM_CXFIXEDFRAME = 7;
public const int SM_CYCAPTION = 4;

public int TitleBarHeight(){
    IntPtr hTheme = IntPtr.Zero; // Using the default theme of windows
    int titleBarHeight = GetThemeSysSize(hTheme, SM_CYCAPTION);
    int titleBarBorderSize = GetThemeSysSize(hTheme, SM_CXFIXEDFRAME);
    return requiredTitleBarPadding = titleBarHeight + titleBarBorderSize;
}

This function return 32 for normal text size and 51 on 225% Text Size setting which seem to match the default title bar height behavior.

If the text size is set to 100% the GitBash window I used as an example has the same title bar height as the test MAUI application.

100%TextSize

But when I set the text size to 225% the GitBash window title bar adjusts, but the test application title bar height seems to be unchanged.

225%TextSize

I checked this documentation : https://learn.microsoft.com/en-us/windows/apps/design/basics/titlebar-design#search and I see that the title bar height is 32 by default and with special elements it is 48. My question is if this is a settings issue or it is just not adjusting by default in MAUI? I could not find a setting that disables the default behavior. Thanks

Steps to Reproduce

  1. Create MAUI Application
  2. Change Accessibility > Text Size in the Windows Settings
  3. Compare Title bar height

Link to public reproduction project repository

No response

Version with bug

8.0.70 SR7

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

No response

@akedves akedves added the t/bug Something isn't working label Aug 2, 2024
Copy link
Contributor

github-actions bot commented Aug 2, 2024

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@RoiChen001 RoiChen001 added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Aug 5, 2024
@RoiChen001
Copy link

I can repro this issue at Windows platform on the latest 17.11.0 Preview 6.0(8.0.70 & 8.0.71).

@PureWeen PureWeen added this to the Backlog milestone Aug 9, 2024
@Foda Foda self-assigned this Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-titlebar platform/windows 🪟 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants