Problem/Motivation
The alternative text field in the CKEditor5 image dialog reads "Text alternative". It would be better if it read "Alternative text". This would be consistent with the CKEditor media dialog as well as with how this content is normally referred to in the accessibility community.
Steps to reproduce
Steps:
1. Go to simplytest.me
2. Type core in the field
3. Select Drupal core, latest version
4. Click the button to create the site
5. Log in as admin
6. If the management menu is not displayed, click Manage
7. Click content
8. Click add content
9. Click Basic page
10. Click in the body field
11. Click the image icon in the WYSIWYG toolbar
Expected result: alternative text field is labeled "Alternative text"
Actual result: alternative text field is labeled "Text alternative"

The W3C, in its discussion of decorative images, refers to a text alternative which is presented outside of the alternative text field.
I believe that "alternative text" rather than "text alternative" is the correct label for this field. This is because the wording "alternative text" specifically makes it clear that it refers to text which is destined for the alt attribute on an image when the page is rendered. A "text alternative," on the other hand, could refer to any descriptive text for the image, regardless of whether it appears in the alt attribute or, as referred to in the linked W3C content, as visible text on the web page.
Proposed resolution
Edit "Text alternative" to "Alternative text"
Merge request link
Remaining tasks
User interface changes
Visible field label in image dialog changes from "Text alternative" to "Alternative text".
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #27 | 3419894-nr-bot.txt | 114 bytes | needs-review-queue-bot |
| #26 | After MR Applied.png | 75.38 KB | Amir Gurung |
| #22 | 3419894-rename-text-alternative-field.patch | 35.5 KB | nikita.gupta |
| #13 | Afterpatch_6520.png | 7.7 KB | kanchan bhogade |
| #8 | Afterpatch_txt.png | 7.39 KB | kanchan bhogade |
Issue fork drupal-3419894
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:
- 3419894-rename-text-alternative
changes, plain diff MR !6520
- drupal-3419894
changes, plain diff MR !6497
Comments
Comment #2
charles belovComment #3
charles belovComment #6
shweta__sharma commentedUpdated the Text alternative field label to Alternative text kindly review it.
After Fix -
Thanks
Comment #7
kanchan bhogade commentedComment #8
kanchan bhogade commentedHi,
Tested And verified patch on Drupal version 11.x
The patch applied successfully...
Testing steps:
Followed the mentioned steps for the issue
Test Result:
The field label text is updated to "Alternative text"
Attaching screenshots for reference
Status "Need Review" for code review
Comment #9
smustgrave commentedMR has failures.
Comment #12
keshav patel commentedMR 6520 is passed, Please Review.
Used the following reference to build: https://www.drupal.org/docs/core-modules-and-themes/core-modules/ckedito...
Comment #13
kanchan bhogade commentedHi,
Tested the latest MR !6520 on Drupal version 11.x
The patch applied successfully...
Test Result:
The field label text is updated to "Alternative text"
Attaching screenshots for reference
Keeping it in Need review for code review
As code is pass, can move to RTBC
Comment #14
smustgrave commentedWhy use a new MR vs the existing one that was pointed to the right branch? Should avoid clutter
Comment #15
wim leersIIRC this was done intentionally. I agree it should be consistent between
drupalImageanddrupalMediathough — that is a bug.Can you please do the necessary git/issue queue archeology to describe why this choice was originally made (and link to that decision), and also describe why that was wrong? That information would be crucial to have in the issue summary 😊🙏
Comment #16
charles belovComment #17
charles belov@wim-leers I did a search in DuckDuckGo and Google for pages on URLs beginning www.drupal.org/project/drupal/issues which contained both "text alternative" and "alternative text" (with quotes) as character strings. None of the issues which turned up as obvious choices had a discussion about which was the appropriate choice for the label.
I also searched for git.drupalcode.org content containing "text alternative," with no results in either engine.
I have updated the issue descriptions to add my reasoning as to why I believe "Alternative text" is the correct label.
Comment #18
charles belovMinor word omission fix
Comment #19
smustgrave commentedRecommend using the git blame on the file to find the ticket it was added in and if discussion was done for it.
Comment #20
charles belov*** obsolete comment ***
Comment #21
charles belov\core\modules\ckeditor5\js\ckeditor5_plugins\drupalImage\src\imagealternativetext\ui\imagealternativetextformview.js
shows the line
labeledInput.label = Drupal.t('Text alternative');was last committed with
c6d7b83fa35 (bnjmnm 2022-03-31 08:18:19 -0400 254)
However, if I search for c6d7b83fa35 on either drupal.org or git.drupalcode.org, I get no results.
I do see relevant issues involving @bnjmnm which were updated around that time:
The latter issue does have the comment:
but I don't see anything in the issue discussing "Alternative text" versus "Text alternative".
Comment #22
nikita.gupta commentedComment #25
amire commentedHere, I have applied MR !6520, and it was working successfully. I am attaching the screenshot for review. The Drupal version used is 11.x-dev.
Comment #26
Amir Gurung commentedHere, I have applied the MR !6520, and it was working for me. I am attaching the screenshot for review.
used version 11.x-dev
for the reff. i have attached the screen capture
Comment #27
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #29
mithun sUpdated the original MR and fixed the Pipeline issue.
Comment #30
smustgrave commentedAppears the researched requested was done in #17 (saving credit for that and to @Wim Leers for the review)
Comment #31
charles belovFor clarification, the research requested was done in #17 and #21.
Comment #32
wim leersThe research is incomplete. We should investigate why the current string was adopted.
Comment #33
wim leersThis string was added in #3222757: [drupalImage] Make image alt text required or strongly encouraged.
Comment #34
wim leersThe words first appear in accessibility maintainer @andrewmacpherson's comment at #3222757-32: [drupalImage] Make image alt text required or strongly encouraged.
That's the only place it ever occurred, it seems 🤠
\Drupal\editor\Form\EditorImageDialog::buildForm()has said since 2015, as has its validation error if it's missing:'#required_error' => $this->t('Alternative text is required.<br />(Only in rare cases should this be left empty. To create empty alternative text, enter <code>""— two double quotes without any content).'),So: +1! This is ready. Sorry for slowing us down, but I want to ensure we definitely get it right this time 😊
⚠️ More importantly, my research shows that thanks to this very string already existing in
EditorImageDialog, this is not a string change, because the string already exists and hence already has a translation! 🥳Comment #39
nod_Awesome, and since the string exists, I'll backport to 10.2.x to have is asap :)
Committed c45941b and pushed to 11.x. Thanks!