Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Port See #3.\Drupal\Tests\ckeditor5\FunctionalJavascript\MediaTest::testDialogAccess()
.
The alt_field
setting for image media must be respected.
Steps to reproduce
- Install Drupal with the Standard profile.
- Create a CKE5 instance with a Media button.
- Go to
/admin/structure/media/manage/image/fields/media.image.field_media_image
and disable the alt field. - Insert an image using the media functionality in CKE5.
- 🐛 Observe that the
Override media image alternative text
button is present when it should not be.
Proposed resolution
Tests.Fix.
Remaining tasks
Reviews!
User interface changes
The Override media image alternative text
button only appears anymore when it should.
API changes
None.
Data model changes
None.
Release notes snippet
N/A
Comment | File | Size | Author |
---|---|---|---|
#9 | 3275120-9.patch | 5.47 KB | Wim Leers |
| |||
#9 | interdiff.txt | 1.91 KB | Wim Leers |
#5 | 3275120-5.patch | 5.18 KB | Wim Leers |
| |||
#5 | interdiff.txt | 1.16 KB | Wim Leers |
#4 | 3275120-4.patch | 4.15 KB | Wim Leers |
Comments
Comment #2
Wim LeersComment #3
Wim LeersThis is irrelevant because:
\Drupal\media\Form\EditorMediaDialog
.ckeditor5_drupalMediaCaption
CKE5 plugin literally only loads if thefilter_caption
filter is enabled, same formedia_mediaAlign
andfilter_align
.… the one exception is … that the
alt_field
setting on "image" media is not respected yet 😬☹️ That's this piece of the CKE4 test coverage:Even if one disables that (for example, for purely decorative images that do not need descriptions, however farfetched that might be), CKE5 will continue to show the alt override UI in its media toolbar.
So … converting this task into a bug 😬
Comment #4
Wim LeersHere's a test.
Comment #5
Wim LeersAnd here's the fix.
Comment #7
bnjmnmMost of the feedback I thought I was going to provide was addressed by remembering that
\Drupal\Tests\ckeditor5\FunctionalJavascript\MediaTest::testAlt
already does what I wanted done (it's just not in the patch because it already exists).What remains is just doc nits:
May be clearer to move the comment above the conditional and make it cooperate with the
if()
such as "Check if the alt field is enabled"s/Tests the/Tests that the
(this bumps it over the char limit, so it'll probably require something additional)
Comment #8
Wim LeersComment #9
Wim LeersWhat do you think?
Comment #10
bnjmnmThat looks good to me!
Comment #15
lauriiiI like this fix! 🤩
Committed 76486e0 and pushed to 10.1.x. Also cherry-picked to 10.0.x, 9.5.x, and 9.4.x. Thanks!