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

MudText: Replace h6 with span for subtitle typos (#6059) #6061

Merged
merged 1 commit into from
Mar 27, 2024

Conversation

tpmccrary
Copy link
Contributor

Instead of initializing the text with <h6> tag for Typo.subtitle1 and Typo.subtitle2, initializes it with the more generic inline container: <span> tag.

Description

Resolves #6059
When using Typo.subtitle2 on MudText, the text is not centered vertically, causing it to look strange with all other vertically centered text.
After further investigation with inspect element, it turns out that the text is being initialized using the tag <h6>, causing this inconsistency.

How Has This Been Tested?

Visually

Types 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)

The text "The University of Somewhere" with Typo.subtitle2 using <h6>:
image

The text "The University of Somewhere" with Typo.subtitle2 using <span>:
image

Direct comparison. <h6> on the left, <span> on the right.
image

Checklist:

  • The PR is submitted to the correct branch (dev).
  • My code follows the code style of this project.
  • I've added relevant tests.

@codecov
Copy link

codecov bot commented Dec 29, 2022

Codecov Report

Base: 91.52% // Head: 91.53% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (34f9237) compared to base (a6116c6).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #6061   +/-   ##
=======================================
  Coverage   91.52%   91.53%           
=======================================
  Files         383      383           
  Lines       15019    15019           
=======================================
+ Hits        13746    13747    +1     
+ Misses       1273     1272    -1     
Impacted Files Coverage Δ
src/MudBlazor/Components/Typography/MudText.razor 100.00% <100.00%> (ø)
...r/Components/Autocomplete/MudAutocomplete.razor.cs 92.85% <0.00%> (+0.42%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mikes-gh
Copy link
Contributor

mikes-gh commented Jan 1, 2023

Not sure about this. Because it is visually breaking. It solves a specific but is it a good idea for all scenarios?

@JonBunator

@erikemtz
Copy link

erikemtz commented Jan 4, 2023

Seems like span used to be used too

@dennisrahmen
Copy link
Contributor

For me at least it's annoying every time I see the text not aligned properly.

Maybe it could be included in the 7.x version with the other breaking changes?

Copy link
Member

@JonBunator JonBunator left a comment

Choose a reason for hiding this comment

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

How are you centering the text?

@tpmccrary
Copy link
Contributor Author

How are you centering the text?

The text becomes vertically centered when I change it to use the <span> tag.

@lortimer
Copy link

I encountered this bug while using MudBlazor today and I came here to make sure there was a plan to address it. I want to answer @mikes-gh 's question above:

Not sure about this. Because it is visually breaking. It solves a specific but is it a good idea for all scenarios?

This is a very important issue to fix for accessibility purposes for all scenarios. People who use assistive technology often navigate pages by the heading elements on the page. Mobile and desktop screen readers can list and read the headings on a page to help a user find the section they want without reading the whole page top to bottom. The h1 through h6 elements should only be used to create this kind of semantic structure in a document, not for styling text.

When developers use the Typo.subtitle1 and Typo.subtitle2 typographies, they are expecting to style the text as a subtitle - they are not expecting to create or change any semantic structure. The fact that these elements create an h6 on the page creates confusion for people using assistive technologies. Developers using MudBlazor may inadvertently fail to meet WCAG 2.1 success criteria 1.3.1 and 2.4.10, which they may be required to meet.

At a practical level this bug could create a scenario like the example below without the developers realizing it.

<h1>Main Heading</h1>
<h2>Topic 1</h2>
...Some content here
<h6>This is supposed to be text styled as a subtitle, but is now a misplaced heading</h6>
<h3>Subtopic 1</h3>

This could be confusing for users, because now the h3 for subtopic 1 is no longer semantically linked to topic 1.

I was not able to reproduce the vertical alignment issue mentioned above, but it doesn't surprise me because span is an inline element and the heading elements are block elements. I would suggest using the p element instead of span because p is also a block element. body1 and body2 already use p. I'm happy to submit a PR for that, but I don't know how to reproduce the vertical alignment issue. Maybe @tpmccrary could try using a p instead and see if the vertical alignment issue persists.

I hope you can find a way to fix and release this as soon as possible because of the potential impact this has on the accessibility of web apps using MudBlazor.

@dennisrahmen
Copy link
Contributor

dennisrahmen commented Mar 29, 2023

I would root for replacing the <h6> with <span> and merging this with all the other breaking changes for v7.
That would fix the alignment as well as the screen reader issue.

@lortimer
Copy link

@dennisrahmen When is version 7 going to be released? Any reason not to even try using p instead so it could be released in some v6 version? Releasing it in v6 would make the fix available to a lot of apps that will never upgrade to v7.

MudBlazor is an authoring tool and as such has take accessibility seriously. It should make creating accessible web interfaces easier and avoid creating accessibility issues that developers might miss.

@dennisrahmen
Copy link
Contributor

dennisrahmen commented Mar 29, 2023

@lortimer the last thing I read, from I think @henon, is that the v7 release is already overdue.

Regarding:

Releasing it in v6 would make the fix available to a lot of apps that will never upgrade to v7.

If they are not upgrading to v7 then they also might not upgrade to v6.x, as v7 does only include minor breaking changes compared to most other libraries I use. Thats my opinion, I am just a user here.

@ScarletKuro
Copy link
Member

@henon should we add this to v7 project?

@henon henon added the v7 New major MudBlazor version label Jul 20, 2023
@henon henon changed the base branch from dev to v7 July 20, 2023 15:09
@henon henon changed the title MudText: Replaced h6 with span for subtitle typos (#6059) MudText: Replace h6 with span for subtitle typos (#6059) Jul 20, 2023
@henon
Copy link
Collaborator

henon commented Jul 20, 2023

I changed the target branch to v7. Are there any other accesibility changes that should be made in MudText or is everything else fine?

@danielchalmers
Copy link
Contributor

I changed the target branch to v7. Are there any other accesibility changes that should be made in MudText or is everything else fine?

Target branch can be changed back to dev @henon

@henon henon changed the base branch from v7 to dev March 27, 2024 20:42
@henon henon merged commit b13a71e into MudBlazor:dev Mar 27, 2024
@henon
Copy link
Collaborator

henon commented Mar 27, 2024

Thank you for the patience, I know it has been a long wait. v7.0.0 is finally being actively worked on. All breaking changes are summarized in the v7.0.0 Migration Guide #8447

@henon henon mentioned this pull request Mar 27, 2024
@ScarletKuro
Copy link
Member

ScarletKuro commented Mar 27, 2024

This PR broke some tests and they are not flaky, once I fetched https://github.com/MudBlazor/MudBlazor/actions/runs/8458390892/attempts/2 once I fetched this change I see locally the same picture

@ScarletKuro
Copy link
Member

Seems ScrollToTopTest is the only one

ScarletKuro added a commit to ScarletKuro/MudBlazor that referenced this pull request Mar 27, 2024
@ScarletKuro
Copy link
Member

ScarletKuro commented Mar 27, 2024

Fixed it in this PR #8506
It's now more spans so it couldn't find the correct element since it was just Find("span").

upd: decided to make separate PR just for this test #8507 and merge it right away, since it might block others and I don't want to make them wait.

@ScarletKuro ScarletKuro mentioned this pull request Mar 28, 2024
6 tasks
danielchalmers added a commit to danielchalmers/MudBlazor that referenced this pull request Apr 20, 2024
Regression inadvertantely caused by MudBlazor#6061 because the styles in the landing page were set up to modify the html headers themselves instead of just changing the typography variables.
biegehydra pushed a commit to biegehydra/MudBlazor that referenced this pull request Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update Typo.subtitle1 and Typo.subtitle2 to use <span> instead of <h6>
9 participants