Problem/Motivation

The vertical tabs title items (the elements that one clicks to select a tab) use a strong element.

From the HTML spec:

The strong element represents strong importance, seriousness, or urgency for its contents.

That probably doesn't apply to these elements, which seem to be simple labels.

Screenshot of a the first tab at /admin/config/people/accounts, with the corresponding element highlighted in DevTools:

Current markup:

<strong class="vertical-tabs__menu-item-title">... Tab title ...</strong>

Steps to reproduce

  • Set Default Admin as the administration theme.
  • Go to /admin/config/people/accounts.
  • Inspect the vertical tab titles in the browser inspector.

Proposed resolution

Use another element, probably a span.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3612323

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

kentr created an issue. See original summary.

kentr’s picture

Issue summary: View changes
mgifford’s picture

Priority: Normal » Minor

So for clarity we are suggesting that we move to:

<span class="vertical-tabs__menu-item-title">... Tab title ...</span>

So we'd need to make sure that 'class="vertical-tabs__menu-item-title"' was visually bolded, avoiding the potential accessibility error described here:

I'm not sure how big an issue this is, and if perhaps <b> might be a better option still:
https://accessibility.psu.edu/boldfacehtml/

However it may still likely trigger false positives (depending on how you interpret this WCAG SC).

kentr’s picture

I believe the bold font weight is already set in CSS, to 575:

.vertical-tabs__menu-item-title {
  font-weight: var(--admin-font-weight-bold);
}

It should just be a matter of changing the HTML tag.

mgifford’s picture

Issue tags: +Novice

luissousa21 made their first commit to this issue’s fork.

luissousa21’s picture

Status: Active » Needs review

MR !16871 changes the strong element to a span in core/themes/default_admin/js/vertical-tabs.js.

Confirming @kentr's point in #5 that this is only an HTML tag change, the bold is already set in CSS, so there is no visual difference. .vertical-tabs__menu-item-title is a class-only selector carrying font-weight: var(--admin-font-weight-bold), and --admin-font-weight-bold: 575 is defined on :root in css/_variables/variables-typography.css. I checked the computed value in a browser: it is 575 both before and after the change, because the strong was already being overridden to 575 rather than the user agent default of 700.

One thing worth flagging for scope. The same strong element with class vertical-tabs__menu-item-title is emitted in two other places:

  • core/misc/vertical-tabs.js
  • core/themes/claro/js/vertical-tabs.js

Neither of those has a font-weight rule for .vertical-tabs__menu-item-title. Claro has no rule for that class at all, and core/misc/vertical-tabs.css and stable9 only reference it inside :focus, :hover and .is-selected selectors. So in those two the bold comes from the user agent default for strong, and changing the element there without adding a font-weight declaration would silently unbold the tab titles.

I have left those alone, since this issue sits under #3585823, but they have the same semantic problem and would each need a CSS change alongside. Happy to open a follow-up if that would be useful.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new89.26 KB
new84.47 KB

dark

light

Seems as though styling is unchanged so change seems fine.

For another stable9 related since it's been removed already we can open an issue in contrib for it.

  • amateescu committed dd7ad22a on 11.x
    fix: #3612323 Do not use strong element for vertical tabs titles
    
    By:...

  • amateescu committed de104d38 on main
    fix: #3612323 Do not use strong element for vertical tabs titles
    
    By:...
amateescu’s picture

Version: main » 11.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed de104d38df1 to main and dd7ad22a7fe to 11.x. Thanks!

Let's open the followup for the findings in #9 and link to it here :)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.