I need to style some part of the accordion tabs titles (for exemple applying a colour on a word in the middle of the title). Currently, the title strips all html elements. Is it possible to allow some HTML selectors in title, like "span", "strong", "u", etc.?

It should be noted that the Javascript adds HTML to the title, so if Drupal behaviors are attached more than once, the added HTML and the title will be stripped.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Xoruna created an issue. See original summary.

ToxaViking’s picture

Hello Xoruna

You should configure allowed tags at the text format configuration page

ToxaViking’s picture

Status: Active » Needs review
xoruna’s picture

I'm using full html text format, which doesn't limit allowed text format. Is there something else to configure?

xoruna’s picture

Status: Needs review » Active

Atropoides made their first commit to this issue’s fork.

atropoides’s picture

Status: Active » Needs review

I found out that it used the jQuery text method that strips out all html from the title.
To use html in the title I changed it to the jQuery html method.

See Merge Request #3.

nitebreed’s picture

Status: Needs review » Reviewed & tested by the community

Exactly what I needed in one of my projects as well, works perfectly!

xoruna’s picture

Thanks for your contribution Atropoides! The project I needed this for is over, but I'm sure it will be useful in the future.

bernardm28 made their first commit to this issue’s fork.

bernardm28’s picture

I probably should have done that change on a separate PR. However, the commit above does not add anything new. It just brings back some of the accessibility items that the module itself provided and it merges those with Atropoides changes.

Hydra made their first commit to this issue’s fork.

hydra’s picture

Version: 8.x-1.1 » 2.0.x-dev

I added a second MR where I upgrade the solution to work with the non-jquery version in 2.0.x branch for everyone using this and doing an upgrade.

charles belov’s picture

It would also need to be possible to add language spans if one of the accordion titles is in a different language.

solideogloria’s picture

I added a second MR where I upgrade the solution to work with the non-jquery version in 2.0.x branch for everyone using this and doing an upgrade.

This change is actually necessary for the accordion to work at all in the 2.0.x version if the behaviors are attached more than once. I think maybe the once function isn't working properly? If behaviors are attached a second time, all the accordion title text disappears.

Notice that once is not added as a parameter where it should be:

  dependencies:
    - core/drupal
    - core/drupalSettings
    - core/once
/**
 * @file
 * CKEditor Accordion functionality.
 */

(function (Drupal, drupalSettings) {
  'use strict';
...
})(Drupal, drupalSettings);
solideogloria’s picture

Category: Feature request » Bug report

Marking as a bug report because of this.

solideogloria’s picture

Priority: Normal » Major
solideogloria’s picture

Title: adding some HTML to accordion title » Fix title stripping HTML elements
Issue summary: View changes
solideogloria’s picture

Applying the changes in MR 12 fixes the issue.

j-vee’s picture

Thanks everyone, there's a new configuration option in 2.2.2 to Allow HTML in Titles.

j-vee’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.