Problem/Motivation
When an author embeds image media in the wysiwyg editor, they can choose to:
- accept the default text alternative previously stored with the media entity, or
- override the alt text with an instance-specific alt text,
If they accept the default alt text (because it is appropriate for the context) this isn't explicitly recorded; i.e. nothing is stored in the editor markup.
BUT if the default alt text stored with the media entity changes at a later date, then the new alt text propagates to the all existing embed instances which haven't overridden it.
The problem is that the original alt text may have been accepted because is was appropriate to the context, but the new alt text might not be. The upshot is that there may be unintended side effects, where content effectively changes it's meaning.
This is almost in the realm of accidental data loss.
Proposed resolution
When authors embed a media image, and accept the default ALT text from the media entity, explicitly store it in the <drupal-media alt="whatever" markup.
Remaining tasks
TBD.
User interface changes
TBD.
API changes
TBD.
Data model changes
None?
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | 3084011-8.patch | 845 bytes | phenaproxima |
Comments
Comment #2
andrewmacpherson commentedbrain dump slack conversation from today. Use this to update the issue summary.
Comment #3
andrewmacpherson commentedTempted to say critical, this is almost in the area of data loss.
Comment #4
andrewmacpherson commentedWhat the heck, we can triage it down again if needs be.
Must decide on policy for this before marking media library as stable.
Comment #5
DeFr commentedJust chiming in, but from an accessibility point of view, I'm not sure storing that alt text all the time is the correct thing to do ; this issue right now focuses on the idea that the alt text may change, but think about it the other way, the embedded image can be changed too, and this will be propagated everywhere.
If you've copied the alt text everywhere and it's no longer appropriate for the new image, then, you'll have to manually go back to all the content embedding that media and re-change the alt text there too.
Comment #7
phenaproximaThis would be quite trivial from an implementation standpoint. So this issue, IMHO, is not primarily technical in nature.
The real problem is the user expectation. What is the right thing to do? As Andrew and I discussed in #2, it's not clear.
Because it is (I think) so easy to do on a technical level, my suggestion is to make this behavior configurable. I'm not sure if it should be globally configurable or specific to the text format configuration, or what the default behavior should be, but this seems like a case where we might want to have it both ways because I agree, this could almost -- almost -- be considered data loss if authors are not expecting it.
At the very least, this should be explicitly documented in our handbook before we downgrade this issue to a less severe priority.
Comment #8
phenaproximaHere, for manual testing purposes, is a one-line proof of concept patch. Note that, if our tests are checking that "upstream" changes to alt text get propagated to embeds, it will likely break existing test coverage. (Which is good; that means we have comprehensive tests, and that the current behavior was intentional :)
Comment #9
catchIf you do this, can the alt text be identical to the one in the media item? If so I'm not sure we should change the current behaviour at all since we'd be losing the option to just rely on the media entity and there's already a workaround.
Comment #10
phenaproximaYes, it can.
Comment #11
catchOK in that case I'm definitely downgrading this from critical to major, but potentially we need to be clearer to end users what the behaviour is.
Comment #12
phenaproximaRe-titling to remove the word "loss", now that @catch has chimed in and does not consider this a data loss.
Comment #13
andrewmacpherson commentedHow is an unintended content change, which happens elsewhere, not data loss?
The title change de-emphasizes the consequences of an action. The problem is not so much that the source of alt text isn't clear when dealing with an instance where a media entity is used. Rather it's that when dealing with a media entity itself, the consequence of changing the alt text isn't conveyed.
It might not be data loss from the perspective of a database administrator, but it is data loss from the perspective of a content manager.
Comment #14
phenaproximaI agree with this assessment, and that's why this is definitely a major problem that needs to be fixed as soon as possible.
However, I still don't think it's data loss in the normal sense that the term is used in Drupal. As I understand it, when a committer says "data loss", they're referring to loss of explicit user input. This bug is not that. If the user inputs explicit alt text, even if it's the same as the default, that alt text is remembered.
Comment #15
phenaproximaTagging this important issue to be worked in at DrupalCon Amsterdam.
Comment #16
andrewmacpherson commentedI chatted with @phenaproxima about this...
I'll update the media and media_library roadmap issues.
Comment #19
andrewmacpherson commentedComment #20
benjifisherOne of Drupal's strengths is its structured data.
A practical example of that is that an image can be used in many places, with consistent alt text. But consistent does not mean correct: the same typo may appear consistently everywhere that image is used. With the current behavior, all of those images (potentially) are getting their alt text from the media item. Fix the typo there, and you fix it everywhere.
I do not want to lose that feature unless there is a strong argument in favor of the alternative.
If we want alternatives, then they can be provided by contrib modules. It should be pretty easy to alter the form, add a submit function, and change the way alt text is handled.
Comment #21
volkswagenchickAdding
NorthAmerica2021tag for visbility.DrupalCon NA is April 12-16 with a focus on EOOTB on Wednesday, April 14.
Thanks
Comment #27
smustgrave commentedThis came up as a daily BSI target.
Is the issue here that the alt text is not included in the embed code? Is that really a problem though?