Skip to content

Conversation

liamAU28910
Copy link
Contributor

@liamAU28910 liamAU28910 commented May 25, 2025

To prevent issues with page scaling, the slider underneath a tab's position and scale are set to a percentage based on the active tabs size relative to the size of all panels.

Description

Fixes #11404

How Has This Been Tested?

A scale of 0.75 was applied in the MainLayout.razor to reproduce the bug then tested visually.

Visual testing for fixed width tabs:
Pre-fix:
pre-fix-1
Post fix:
post-fix-1

Visual testing for variable width and vertical tabs:
Pre-fix:
pre-fix-2
Post fix:
post-fix-2

Type of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (fix or improvement to the website or code docs)

Checklist

  • The PR is submitted to the correct branch (dev).
  • My code follows the code style of this project.
  • I've added relevant tests. (Updated existing tests to expect percentage values instead of pixel values. Due to floating point precision error, checking for approxomations with a precision of 0.00001)

To prevent issues with page scaling, the slider underneath a tab's position and scale are set to a percentage based on the active tabs size relative to the size of all panels.
@github-actions github-actions bot added bug Unexpected behavior or functionality not working as intended PR: needs review labels May 25, 2025
@liamAU28910 liamAU28910 marked this pull request as draft May 25, 2025 16:51
Tests now look for the appropriate percentage value, not pixel value. Due to floating point precision errors, using BeApproxiately with a precision of 0.00001.
Copy link

codecov bot commented May 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.10%. Comparing base (6e7b5da) to head (fb55b99).
Report is 2 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev   #11405   +/-   ##
=======================================
  Coverage   91.10%   91.10%           
=======================================
  Files         465      465           
  Lines       14407    14407           
  Branches     2788     2788           
=======================================
  Hits        13126    13126           
  Misses        642      642           
  Partials      639      639           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@liamAU28910 liamAU28910 marked this pull request as ready for review May 25, 2025 18:24
Copy link

@liamAU28910 liamAU28910 changed the title Slider now uses percentage positioning and scaling MudTabs: Fixed slider misalignment when component is scaled May 25, 2025
@ScarletKuro ScarletKuro changed the title MudTabs: Fixed slider misalignment when component is scaled MudTabs: Fix slider misalignment when component is scaled May 25, 2025
@danielchalmers danielchalmers merged commit 137180c into MudBlazor:dev May 25, 2025
6 checks passed
@danielchalmers
Copy link
Member

Nice work!

@MattiasDeparcqB
Copy link

@danielchalmers
The width style is not in the correct format anymore for me. I get comma's in the value (width:24,16975476196096%;)
The extension previously used formatted the double like this:
public static string ToPx(this double val) => $"{val.ToString("0.##", CultureInfo.InvariantCulture)}px";
Maybe a new extension should be created to 'ToPct' or use at least this one when calling the add style
https://github.com/MudBlazor/MudBlazor/blob/dev/src/MudBlazor/Extensions/DoubleExtensions.cs

@danielchalmers
Copy link
Member

@MattiasDeparcqB Could you create a new issue about this for me?

@MattiasDeparcqB
Copy link

@MattiasDeparcqB Could you create a new issue about this for me?
Created this one: #11448

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Unexpected behavior or functionality not working as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MudTabs: Selected tab underline misalignment when component scaled

4 participants