Closed (fixed)
Project:
Entity Embed
Version:
8.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
10 Jun 2019 at 13:31 UTC
Updated:
30 Jun 2019 at 20:14 UTC
Jump to comment: Most recent, Most recent file



Comments
Comment #2
wim leersc/p error
Comment #3
marcoscanoI believe #2924391: [media entities] Regardless of @EntityEmbedDisplay plugin, Media entities representing a `image/*` MIME type should be able to have a per-embed `alt` and `title` actually introduced a usability bug. If you create an override, currently there is no way you can restore the original text (i.e. un-override what you did) from the same place you did it.
One way of solving it would be to expose something like a link or button "Revert/Remove override" (or better wording) that removes the overridden value and populates the form element with the original alt text?
Comment #4
oknateIf alt isn't required, you can simply remove the text in the alt in the dialog and it will go back to displaying the original. But this isn't possible if alt is required. It's also not documented. I think a button next to the alt and a button next to the title [Restore] would work. There is a work around, which is to remove embed and re-embed it.
Comment #5
oknateNow that I think about it, I think a button is awkward. The original alt can just be added to the form somewhere hidden, and with javascript, it will be restored when you tab way from the field and the field is empty.
Comment #6
marcoscanoThis is the exact same problem that media in core will (have to) solve in #3023807: Override media fields from the reference field, eventually.
Quoting #3023807-9: Override media fields from the reference field, on the UI aspect of it:
I wonder if we can't experiment with the same approach here, which would be also valuable for validating the approach for media in core?
Comment #7
marcoscanoThere may be legitimate use cases where users might want an empty alt. I'm not sure however how often in real life an image would have an original alt set, but editors would want it to be decorative in some places (the example for having an empty alt)... It's true that we could inform them that something like
""can be used to convey the meaning of "I want to override the original with empty alt here", but maybe an explicit action is clearer?Comment #8
oknateHere's a patch where upon tabbing away from alt field, if you have left the field blank, it restores the original alt. The same thing with the title field.
Comment #9
oknateOh, and by the way, if want to leave the alt empty, you can put in two double quotes.
Comment #10
oknateComment #11
oknateComment #12
oknateAdding test coverage.
Comment #13
oknateComment #14
oknateHere's an update that changes it to use the placeholder attribute. It really isn't any different. I thought maybe we should only restore the alt or title if that field is required, but I think it unnecessary, since on the backend it will be doing it anyway. By restoring it in the dialog you make explicit what was previously implicit. Where if the title is not required and they empty it out and it displays the placeholder, but doesn't set the value back to the placeholder, then the UX may be giving the false sense that it won't display the original. It's an easy change to check if it's required and only restore it if it's required.
Comment #15
oknateAnother approach would be to not set the placeholders to the values until mousedown on the "Embed" button.
Comment #16
oknateHere's a version with the approach proposed in #15. Although this begs the question, "Why is alt marked required, if it will be set to the fallback when left blank?" Shouldn't we just not make it required?
Even though the field is required on the original image field, perhaps it shouldn't be in the entity embed dialog, since it will fall back to the original value anyway.
Comment #17
oknateHere's a different approach based on this notion in #16:
This patch removes the required attribute, and simply adds a placeholder. The switching back to the original doesn't need to be in javascript, as it's already happening on the backend.
Comment #18
wim leersThanks, @marcoscano! I agree with your concerns. (That's why I opened this issue in the first place of course.)
placeholderattribute in the issue summary — that's what you see in the screenshots in the issue summary :)placeholderattribute ('#placeholder'in form API).Comment #19
oknateOh dang. I knew there was a '#placeholder' attribute. I was searching the codebase but was searching for 'placeholder' (with single quotes wrapped around the word).
Comment #20
oknateThe placeholder is clear enough.
Comment #21
wim leersThis looks great to me. Assigning to @marcoscano for sign-off since he expressed interest in it before :) But as far as I'm concerned, this is ready.
It now behaves exactly like the screenshots I proposed in the issue summary :)
Comment #23
wim leersComment #24
marcoscano🎉Thanks Nate and Wim! 👏