Skip to content

Conversation

@benhillis
Copy link
Member

Add text scaling factor to window resize calculation and make hero image height responsive to text scaling. Increase minimum window size for better accessibility. Fix MAS 1.4.4 compliance for OOBE dialog.

Add text scaling factor to window resize calculation and make hero image height responsive to text scaling. Increase minimum window size for better accessibility. Fix MAS 1.4.4 compliance for OOBE dialog.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds text scaling support for accessibility to the OOBE (Out-of-Box Experience) window in WSL Settings. The changes ensure that when users increase text size through Windows accessibility settings, the OOBE window properly scales to accommodate the larger text while maintaining usability.

Key changes:

  • Window automatically resizes in response to text scaling changes for accessibility
  • Hero image height dynamically adjusts when text scaling is enabled to preserve content space
  • Copyright headers updated to standardized format

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/windows/wslsettings/Windows/OOBEWindow.xaml.cs Adds text scale factor event handling and updates ResizeWindow() to combine DPI and text scaling factors
src/windows/wslsettings/Windows/OOBEWindow.xaml Increases minimum window size from 480x480 to 600x600 to accommodate scaled content
src/windows/wslsettings/Controls/OOBEContent.xaml.cs Implements dynamic hero image height calculation based on text scaling factor
src/windows/wslsettings/Controls/OOBEContent.xaml Updates margin to use centralized StaticResource for consistency
src/windows/wslsettings/LibWsl.cs Removes trailing whitespace (code formatting cleanup)

Comment on lines 10 to 17
public OOBEContent()
{
this.InitializeComponent();

// Adjust hero image height based on text scaling for better accessibility
var settings = new UISettings();
double textScaleFactor = settings.TextScaleFactor;
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

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

Creating a new UISettings instance in the constructor could be inefficient since UISettings is instantiated every time an OOBEContent control is created. Consider making this a static field or caching it, especially since the text scale factor is system-wide and doesn't need per-instance tracking.

Suggested change
public OOBEContent()
{
this.InitializeComponent();
// Adjust hero image height based on text scaling for better accessibility
var settings = new UISettings();
double textScaleFactor = settings.TextScaleFactor;
private static readonly UISettings _uiSettings = new UISettings();
public OOBEContent()
{
this.InitializeComponent();
// Adjust hero image height based on text scaling for better accessibility
double textScaleFactor = _uiSettings.TextScaleFactor;

Copilot uses AI. Check for mistakes.
Comment on lines 10 to 19
public OOBEContent()
{
this.InitializeComponent();

// Adjust hero image height based on text scaling for better accessibility
var settings = new UISettings();
double textScaleFactor = settings.TextScaleFactor;
double baseImageHeight = 280.0;

Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

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

The text scale factor calculation in OOBEContent is only performed once in the constructor and won't update if the user changes text scaling while the window is open. Unlike OOBEWindow which subscribes to TextScaleFactorChanged events, this control has no mechanism to react to runtime accessibility changes. Consider subscribing to UISettings.TextScaleFactorChanged to update HeroImageHeight dynamically.

Suggested change
public OOBEContent()
{
this.InitializeComponent();
// Adjust hero image height based on text scaling for better accessibility
var settings = new UISettings();
double textScaleFactor = settings.TextScaleFactor;
double baseImageHeight = 280.0;
private UISettings _uiSettings;
public OOBEContent()
{
this.InitializeComponent();
// Adjust hero image height based on text scaling for better accessibility
_uiSettings = new UISettings();
UpdateHeroImageHeight(_uiSettings.TextScaleFactor);
// Subscribe to text scale factor changes for runtime accessibility updates
_uiSettings.TextScaleFactorChanged += UISettings_TextScaleFactorChanged;
this.Unloaded += OOBEContent_Unloaded;
}
private void UISettings_TextScaleFactorChanged(UISettings sender, object args)
{
// Update hero image height when text scale changes
if (_uiSettings != null)
{
UpdateHeroImageHeight(_uiSettings.TextScaleFactor);
}
}
private void OOBEContent_Unloaded(object sender, RoutedEventArgs e)
{
if (_uiSettings != null)
{
_uiSettings.TextScaleFactorChanged -= UISettings_TextScaleFactorChanged;
}
this.Unloaded -= OOBEContent_Unloaded;
}
private void UpdateHeroImageHeight(double textScaleFactor)
{
double baseImageHeight = 280.0;

Copilot uses AI. Check for mistakes.
// Adjust hero image height based on text scaling for better accessibility
var settings = new UISettings();
double textScaleFactor = settings.TextScaleFactor;
double baseImageHeight = 280.0;
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

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

The magic number 280.0 appears to match the default value in HeroImageHeightProperty (line 59), but this duplication could lead to maintenance issues. Consider using a named constant or referencing the dependency property's default value to maintain a single source of truth.

Copilot uses AI. Check for mistakes.

// Reduce image height when text scaling increases to preserve content space
// Use inverse relationship: as text gets larger, image gets proportionally smaller
HeroImageHeight = Math.Max(baseImageHeight / textScaleFactor, 200.0);
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

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

The magic number 200.0 represents the minimum hero image height but is hardcoded without explanation. Consider extracting this to a named constant (e.g., MinimumHeroImageHeight) to improve code clarity and maintainability.

Copilot uses AI. Check for mistakes.
@benhillis benhillis merged commit 9fad2a1 into master Nov 13, 2025
6 checks passed
benhillis added a commit that referenced this pull request Nov 26, 2025
* wslsettings: allow OOBE window to close with escape key (#13686)

* wslsettings: allow OOBE windows to close with escape key

* fix memory leak

---------

Co-authored-by: Ben Hillis <[email protected]>

* Localization change from build: 133610492 (#13704)

Co-authored-by: WSL localization <[email protected]>

* wslsettings: fix OOBE text truncation at 200% text scaling (#13693)

* wslsettings: fix OOBE text truncation at 200% text scaling

Add text scaling factor to window resize calculation and make hero image height responsive to text scaling. Increase minimum window size for better accessibility. Fix MAS 1.4.4 compliance for OOBE dialog.

* pr feedback

---------

Co-authored-by: Ben Hillis <[email protected]>

* wslsettings: add underlines to links in about page (#13703)

Co-authored-by: Ben Hillis <[email protected]>

* .clang-format: add InsertBraces: true and minor fix to FormatSource.ps1 (#13712)

Co-authored-by: Ben Hillis <[email protected]>

* Localization change from build: 134015316 (#13731)

Co-authored-by: WSL localization <[email protected]>

* wslsettings: ensure selected setting is auto-expanded and selected (#13689)

* wslsettings: ensure selected setting is auto-selected

Implement keyboard focus management for SettingsExpander controls across settings pages. This resolves an accessibility issue reported internally.

* add asserts

---------

Co-authored-by: Ben Hillis <[email protected]>

* build: fix minor compiler errors when building with VS2026 (#13744)

* build: fix minor compiler errors when building with VS2026

* s

* use VS2022 for clang format and cross compiling

---------

Co-authored-by: Ben Hillis <[email protected]>

* chore(distributions): Almalinux auto-update - 20251119 12:04:35 (#13743)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Mask systemd-networkd-wait-online.service during boot (#13611)

* deps: update a number of NuGet packages to the latest available versions (#13728)

Co-authored-by: Ben Hillis <[email protected]>

* Notice change from build: 134267142 (#13751)

Co-authored-by: WSL notice <[email protected]>

* Add *.slnx to .gitignore (#13754)

* Fix service crash when collecting a linux crash dump when maxCrashDumpCount is set to 0 (#13755)

* Fix service crash when collecting a linux crash dump when maxCrashDumpCount is set to 0

* Move the check inside the function

* cleanup: VirtioNetworking refactoring (#13760)

* cleanup: update VirtioNetworking class to not rely on the WslCoreConfig struct

* cleanup: simplify VirtioNetworking construction

* remove old constructor and other cleanup

* more minor cleanup

* string cleanup in HandleVirtioModifyOpenPorts

---------

Co-authored-by: Ben Hillis <[email protected]>

* cleanup: switch from Microsoft::WRL::ComPtr to wil::com_ptr (#13767)

* cleanup: switch from Microsoft::WRL::ComPtr to wil::com_ptr

* reformat

---------

Co-authored-by: Ben Hillis <[email protected]>

* chore(distributions): Almalinux auto-update - 20251124 17:13:02 (#13780)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Notice change from build: 134527933 (#13782)

Co-authored-by: WSL notice <[email protected]>

* cleanup: VirtioNetworking refactoring to be more portable (#13783)

* cleanup: VirtioNetworking refactoring to be more portable

* more refactoring

* make m_guestDeviceManager private

---------

Co-authored-by: Ben Hillis <[email protected]>

---------

Co-authored-by: Ben Hillis <[email protected]>
Co-authored-by: Blue <[email protected]>
Co-authored-by: WSL localization <[email protected]>
Co-authored-by: AlmaLinux Autobot <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

3 participants