Problem/Motivation

Tooltips now appear for the h2 h3 headings as well, with the font-size from the heading. How can I skip showing the tooltips for headings?

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

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

jandewit6 created an issue. See original summary.

mingsong’s picture

There is not h2 or h3 tag in the tooltip template.

https://git.drupalcode.org/project/tooltip_taxonomy/-/blob/2.1.1/templat...

I don't know where the tags you mentioned come from, maybe come from your theme?

Also there is a field setting to specify what tags are allowed for the tooltip.

mingsong’s picture

Status: Active » Postponed (maintainer needs more info)
gaddman’s picture

I think this is referring to the tooltip inheriting the formatting of the text in which the taxonomy term is present. For example if the node text is bold (ie formatted as <strong>) and contains the term my term:
A sentence with my term in it.

then the tooltip text for 'my term' will be bold as well. Likewise for h2 and other heading levels.

For the <strong> example I added some CSS resets (also resets some other styles):

.tx-tooltip .tx-tooltip-text {
  font-style: normal;
  font-weight: normal;
  letter-spacing: normal;
  line-break: auto;
  text-decoration: none;
  text-shadow: none;
  text-transform: none;
  white-space: normal;
  word-break: normal;
  word-spacing: normal;
  word-wrap: normal;
}
gaddman’s picture

Status: Postponed (maintainer needs more info) » Active
smovs’s picture

Assigned: Unassigned » smovs

smovs’s picture

Assigned: smovs » Unassigned
Status: Active » Needs review
StatusFileSize
new179.49 KB

Indeed, tooltips are added to header tags like h1, h2, etc, inside the CKEditor can look odd.
I added a field to the Conditional form settings that allows users to add excluded tags, for which tooltips are not applied.

@mingsong Please review the MR

mingsong’s picture

StatusFileSize
new68.8 KB
new63.96 KB
new64.3 KB
new119.65 KB

Thanks @Sviatoslav.

I manually tested the feature branch with Drupal 11.2.4.

Here are the result:
The original content.

<p>
    I use <strong>Drupal</strong> a lots.&nbsp;
</p>
<p>
    Drupal is my favourite CMS.
</p>
<p>
    &nbsp;
</p>

original

The rendered result after applying the tooltip.

<div class="text-content clearfix field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>I use <strong>
  Drupal
  
     Drupal is a very popular 
  CMS
  
     CMS stands for content management system.
  

.
  

</strong> a lots.&nbsp;</p><p>
  Drupal
  
     Drupal is a very popular 
  CMS
  
     CMS stands for content management system.
  

.
  

 is my favourite 
  CMS
  
     CMS stands for content management system.
  

.</p><p>&nbsp;</p></div>

result

The tooltip taxonomy terms:
1. CMS
CMS

2. Drupal
Drupal

mingsong’s picture

Sorry, my bad. I forgot to add the '' into the allowed tag for the text format setting.

After adding it, it works as exptected.

mingsong’s picture

Thanks @Sviatoslav.

It is a brilliant ideal to introduce the excluded tags, which make it more flexible.

Thanks @Christopher for the suggestion on . In a situation where a bold tag for a taxonomy term still need, we can use the CSS to prevent unwanted style inherited from the parent element.

So I take those two solutions together.

I think we can confidently release this change.

Appreciate all your works on this module.

  • mingsong committed 6b6cda86 on 2.x authored by smovs
    Issue #3381148 by mingsong, jandewit6, gaddman, smovs: skip headings
    
mingsong’s picture

Status: Needs review » Fixed
StatusFileSize
new75.82 KB

It will be patched with the new release.

result

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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