(Filling this as a followup to #2842064: Form widget shows HTML in label as plain text in the Entity Browser queue)
Right now, ContentTranslationHandler::addTranslatibilityQueue is adding the translatibility clue to a large range of items, including the details one. As is though, Details '#title' content is supposed to only contains plain text ; when being fed a span, it'll be displayed as is to the site contributor.
Not sure yet if this belongs to the content_translation component, to not add a span for things that should be plain text, or to the the form system one, to make details more in line with fieldset, and let it allow markup in the summary the way it allows for markup in the legend.
Steps to reproduce
As is, this is tricky to reproduce using core only, there's no field widget that directly expose a details element. Current steps to reproduce using Entity Browser:
- Install Entity Browse
- Set up a multilingual Drupal, enable content translation
- Set up content content translation for the Article node type
- Create an entity reference field on the Article node type, make it untranslatable
- Set the widget for that entity reference field to use the entity browser widget
- Create a node
- Add a translation for that node
At that point, the widget title will be the field name, suffixed by all languages, with the span being displayed.
Comments
Comment #2
DeFr CreditAttribution: DeFr at Axess Open Web Services commentedAttached patch fixes the problem by making the details summary element more in line with the fieldset legend, allowing HTML tags, so switching component. Not sure that's really the way to go though.
Comment #4
slashrsm CreditAttribution: slashrsm at MD Systems GmbH commentedSolution looks OK to me, but I assume committers will require test coverage for it.
Comment #5
thenchev CreditAttribution: thenchev commentedAdded test coverage.
Comment #7
thenchev CreditAttribution: thenchev commentedComment #8
gngn CreditAttribution: gngn at Computer Manufaktur GmbH commentedWorks for me and looks ok to me (hand applied to an old 8.2 core).
I think this really looks annoying (for an example see the image https://www.drupal.org/files/issues/Entity-browser-label.png attached to the original entity browser issue.
So I would be glad if this gets commited.
Comment #9
vurt CreditAttribution: vurt as a volunteer and at Computer Manufaktur GmbH commentedI rerolled the patch so that it works with a current version (8.3.4).
Comment #10
idebr CreditAttribution: idebr commentedThe problem and the proposed resolution for this issue overlap with the related issue #2652850: Title for details form elements is not set as '#markup' and it will be escaped, but all other form elements use '#markup' and are not escaped. Since this issue has test coverage, I propose the related issue is closed as a duplicate.
Comment #12
lammensj CreditAttribution: lammensj commentedRerolled the patch against 8.4.x
Comment #14
balagan CreditAttribution: balagan at Brainsum commentedI have experienced same behaviour with an untranslatable Date field on a multilingual site. Rerolled the patch against 8.5.x
Comment #16
rwam CreditAttribution: rwam commentedThank you, patch #14 applied successful and works fine with 8.5.1. I have problems with the patches provided in https://www.drupal.org/project/drupal/issues/2652850 so I will use this one.
Comment #18
R.Muilwijk CreditAttribution: R.Muilwijk at iO commentedReroll on 8.6
Comment #19
Berdir#2652850: Title for details form elements is not set as '#markup' and it will be escaped, but all other form elements use '#markup' and are not escaped was now committed, this should no longer be an issue now.
Comment #23
pameeela CreditAttribution: pameeela commentedThanks for reporting this issue. We rely on issue reports like this one to resolve bugs and improve Drupal core.
As part of the Bug Smash Initiative, we are triaging issues that are marked "Postponed (maintainer needs more info)".
Since there was no additional information provided since the issue was postponed or #2652850: Title for details form elements is not set as '#markup' and it will be escaped, but all other form elements use '#markup' and are not escaped was suggested as duplicate, I'm marking the issue "Closed (duplicate)". If anyone can provide information on why this issue is different, please add complete steps to reproduce the issue (starting from "Install Drupal core"), document those steps in the issue summary and set the issue status back to "Active".
Thanks!