Make WordPress Core

#62897 closed defect (bug) (wontfix)

Title attribute of menu item is not correctly displayed in the frontend

Reported by: manuel10503 Owned by:
Priority: normal Milestone:
Component: Menus Version:
Severity: normal Keywords: reporter-feedback
Cc: Focuses: accessibility

Description

Hello,

I’ve noticed that when a title attribute is assigned to a menu item, it is no longer correctly displayed in the frontend. Instead of showing the assigned title, either nothing is displayed, or the title appears empty with just the attribute present.

This issue occurs in the current version of WordPress and affects all menu items with a title attribute.

Steps to reproduce:

  1. Go to "Appearance" > "Menus" and add a title attribute to a menu item.
  2. Save the menu and load the page in the frontend.
  3. Inspect the HTML code of the menu, where the title attribute should be present.

Expected behavior:
The title attribute should be correctly output in the HTML code of the menu item and displayed in the frontend.

Actual behavior:
The title attribute is either not displayed, or it is not rendered correctly in the HTML code.

I would appreciate it if this issue could be resolved in a future version.

Thank you!

Attachments (2)

Screenshot 2025-02-03 142528.png​ (200.7 KB ) - added by manuel10503 21 months ago.
Screenshot 2025-02-03 143123.png​ (273.0 KB ) - added by manuel10503 21 months ago.

Download all attachments as: .zip

Change History (5)

#1 @audrasjb
21 months ago

  • Keywords reporter-feedback added
  • Version 6.7.1

Hello @manuel10503 and thanks for the ticket.
Which theme can be used to reproduce the issue?

Removing accessibility focus as title attributes are considered as a bad accessibility practice (see #24766).

Last edited 21 months ago by audrasjb (previous) (diff)

#2 @manuel10503
21 months ago

To reproduce the issue, you can use an older theme where the menu is still controlled in the classic way (not through Gutenberg). A good example of this would be the "Twenty Twenty" theme.

Additionally, I found that the HTML title is correctly rendered in the source code when the title differs from the navigation label. However, if the title is identical to the navigation label, the title attribute is not rendered.

#3 @joedolson
21 months ago

  • Milestone Awaiting Review
  • Resolution → wontfix
  • Status new → closed

This was an intentional change, omitting title attributes if they are the same as the existing link text. Duplicate title attributes serve no functional purpose, and can introduce accessibility problems.

This was handled in #51299.

Note: See TracTickets for help on using tickets.