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"

Image dialog showing field as being 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"

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

Issue fork drupal-3419894

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

Charles Belov created an issue. See original summary.

charles belov’s picture

Issue summary: View changes
charles belov’s picture

Issue summary: View changes

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

shweta__sharma’s picture

Status: Active » Needs review
StatusFileSize
new153.58 KB

Updated the Text alternative field label to Alternative text kindly review it.

After Fix -

after-patch

Thanks

kanchan bhogade’s picture

Assigned: Unassigned » kanchan bhogade
kanchan bhogade’s picture

Assigned: kanchan bhogade » Unassigned
StatusFileSize
new9.03 KB
new7.39 KB

Hi,
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

smustgrave’s picture

Status: Needs review » Needs work

MR has failures.

Keshav Patel made their first commit to this issue’s fork.

keshav patel’s picture

Status: Needs work » Needs review

MR 6520 is passed, Please Review.

Used the following reference to build: https://www.drupal.org/docs/core-modules-and-themes/core-modules/ckedito...

kanchan bhogade’s picture

StatusFileSize
new7.7 KB

Hi,
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

smustgrave’s picture

Status: Needs review » Needs work

Why use a new MR vs the existing one that was pointed to the right branch? Should avoid clutter

wim leers’s picture

IIRC this was done intentionally. I agree it should be consistent between drupalImage and drupalMedia though — 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 😊🙏

charles belov’s picture

Issue summary: View changes
charles belov’s picture

@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.

charles belov’s picture

Issue summary: View changes

Minor word omission fix

smustgrave’s picture

Recommend using the git blame on the file to find the ticket it was added in and if discussion was done for it.

charles belov’s picture

*** obsolete comment ***

charles belov’s picture

\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:

Is "Default alternative text" the right term? Does it convey enough information?

I think that something like "Alternative text from Media Library" might be clearer?

but I don't see anything in the issue discussing "Alternative text" versus "Text alternative".

nikita.gupta’s picture

Amire changed the visibility of the branch 3419894-rename-text-alternative to hidden.

Amire changed the visibility of the branch 3419894-rename-text-alternative to active.

amire’s picture

Here, 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.

Amir Gurung’s picture

Status: Needs work » Needs review
StatusFileSize
new75.38 KB

Here, 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

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new114 bytes

The 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.

Mithun S made their first commit to this issue’s fork.

mithun s’s picture

Status: Needs work » Needs review

Updated the original MR and fixed the Pipeline issue.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs issue summary update

Appears the researched requested was done in #17 (saving credit for that and to @Wim Leers for the review)

charles belov’s picture

For clarification, the research requested was done in #17 and #21.

wim leers’s picture

Status: Reviewed & tested by the community » Needs work

The research is incomplete. We should investigate why the current string was adopted.

wim leers’s picture

wim leers’s picture

Title: Rename "Text alternative" field label to "Alternative text" » [drupalImage] Rename "Text alternative" field label to "Alternative text"
Status: Needs work » Reviewed & tested by the community
Issue tags: -String change

The words text alternative 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 Alternative text 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! 🥳

  • nod_ committed c45941b0 on 11.x
    Issue #3419894 by shweta__sharma, Mithun S, Kanchan Bhogade, Charles...

  • nod_ committed 66443db1 on 10.3.x
    Issue #3419894 by shweta__sharma, Mithun S, Kanchan Bhogade, Charles...

  • nod_ committed 85f30c3b on 10.2.x
    Issue #3419894 by shweta__sharma, Mithun S, Kanchan Bhogade, Charles...

nod_’s picture

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

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!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.