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

  1. Install Entity Browse
  2. Set up a multilingual Drupal, enable content translation
  3. Set up content content translation for the Article node type
  4. Create an entity reference field on the Article node type, make it untranslatable
  5. Set the widget for that entity reference field to use the entity browser widget
  6. Create a node
  7. 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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DeFr created an issue. See original summary.

DeFr’s picture

Component: content_translation.module » forms system
Status: Active » Needs review
FileSize
895 bytes

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

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

slashrsm’s picture

Status: Needs review » Needs work
Issue tags: +D8Media, +Needs tests

Solution looks OK to me, but I assume committers will require test coverage for it.

thenchev’s picture

Status: Needs review » Needs work

The last submitted patch, 5: 2847131-5-details-allow-html-in-summary-TEST-ONLY.patch, failed testing.

thenchev’s picture

Status: Needs work » Needs review
gngn’s picture

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

vurt’s picture

I rerolled the patch so that it works with a current version (8.3.4).

idebr’s picture

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

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

lammensj’s picture

Rerolled the patch against 8.4.x

Status: Needs review » Needs work

The last submitted patch, 12: 2847131-12-details-allow-html-in-summary.patch, failed testing. View results

balagan’s picture

I have experienced same behaviour with an untranslatable Date field on a multilingual site. Rerolled the patch against 8.5.x

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

rwam’s picture

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

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

R.Muilwijk’s picture

Reroll on 8.6

Berdir’s picture

Status: Needs work » Postponed (maintainer needs more info)

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

pameeela’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)
Issue tags: +Bug Smash Initiative

Thanks 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!