Description
Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)
13.2.2
Bug summary
When you create a link in the Umbraco text editor (based on TinyMCE) and select a page in the page tree as the link target, Umbraco automatically generates a title attribute using the name of the selected page.
If you select a text in the editor and then create a link. For example, if you select the text "Visit our home page" and press "Insert link" and choose "Start" as the link target, the following code will be generated:
<a href="/" title="Start">Visit our home page</a>
The link text and title text are different, which violates WCAG 2.5.3 "Label in Name"
"... words which visually label a component are also the words associated with the component programmatically."
Specifics
If you insert a new link in the text content and select the "Start" page as the link target, Umbraco will automatically insert "Start" into the "Link title" field. When you save the link, Umbraco will generate this code:
<a href="/" title="Start">Start</a>
So far, this is not a major issue, as the link text and title text are the same. However, it's almost always unnecessary to add title attributes, especially when the text is identical to the link text.
Problems arise if you select a text in the editor and then create a link. For example, if you select the text "Visit our home page" and press "Insert link" and choose "Start" as the link target, the following code will be generated:
<a href="/" title="Start">Visit our home page</a>
Now, the link text and title text are different.
The same problem occurs if you change the link text. If you initially create a link to the "Start" page and later edit the link text to "Visit our home page," the title attribute remains "Start."
Additionally, renaming a page can cause issues, as the title attribute of existing links won't automatically update.
This may cause violation of WCAG 2.4.4 Link Purpose (In Context) and 2.4.9 Link Purpose.
Solution:
Using title attributes in HTML is unnecessary in 99.9% of cases.
I recommend separating the link text and the link title into two distinct fields in the dialog box—one for the link text and another for the link title.
If the user has not selected a text when creating a link:
- Autofill the link text (name) field (if it's empty) with the name of selected page.
- Leave the link title field empty and let the user enter a text when needed.
If the user has selected a text when creating a link:
- Autofill the link text (name) field with the selected text.
- Leave the link title field empty and let the user enter a text when needed.
This would likely be a significant breaking change, but without it, developing websites that are fully WCAG-compliant is very challenging.
(I've had to write my own tag helper that parses all links and removes title attributes when the text matches the link target's name.)
Solution 2 (easy):
- Rename "Link title" to "Link text (or name)". This would help users not to confuse link text and titles.
- Use this field as link text only. The text inserted into the a-elements textContent.
- Remove the functionality that insert titles to links since it's almost never needed.
- If users need titles they can add these with a custom plugin or in the HTML code.
Steps to reproduce
-
Edit a Rich Text Editor property in Umbraco backoffice.
-
Write some text.
-
Select text.
-
Click "Insert link" button in the editor.
-
Select a page in Umbraco.
-
Save the link.
-
Check the HTML code. Link text and title text do not match.
-
Place the marker in the editor (but dont select any text).
-
Click "insert link" button.
-
Select a page.
-
Save the link.
-
Edit the link text in the edtior.
-
Check the HTML code. Link text and title text do not match.
Expected result / actual result
Title attributes should no be added to a-elements automatically.