Skip to content

fix(tags): show full tag value as native tooltip on legacy chip hover#35520

Open
oidacra wants to merge 7 commits intomainfrom
issue-35519-legacy-edit-content-tag-chips-have-no-tooltip-when
Open

fix(tags): show full tag value as native tooltip on legacy chip hover#35520
oidacra wants to merge 7 commits intomainfrom
issue-35519-legacy-edit-content-tag-chips-have-no-tooltip-when

Conversation

@oidacra
Copy link
Copy Markdown
Member

@oidacra oidacra commented Apr 30, 2026

Summary

In the legacy (DOJO) Edit Content screen, tag chips (<a class=\"tagLink\">) were rendered without a title attribute. When the chip got visually clipped by the surrounding container, users had no way to see the full tag value short of removing and re-adding the tag.

This adds a single node.title = tagsMap[tagVelocityVarName][tagId].title; assignment inside createTagLink(). The browser now renders a native tooltip with the full value on hover, regardless of whether the chip is truncated.

createTagLink() is the sole factory for chip elements, so the same one-line change covers the suggestion-dropdown path, the fillExistingTags() page-load path, and persona tags.

Old Edit Content

CleanShot 2026-04-30 at 14 09 16@2x

Closes #35519

Acceptance Criteria

  • Hovering a tag chip shows the full tag value as a native browser tooltip (title attribute)
  • Tooltip text equals the stored tag title exactly — no truncation, no extra whitespace
  • Tooltip is present regardless of visual truncation
  • Persona tag chips have the same tooltip behavior via the same createTagLink() code path
  • Tags added via the suggestion dropdown receive the tooltip
  • Tags loaded via fillExistingTags() on page load receive the tooltip
  • Click-to-remove behavior unchanged
  • Chip layout, × close affordance, and CSS classes unchanged
  • Angular Edit Content tag field unaffected (out of scope, tracked separately)

Test Plan

This is a legacy DOJO static JS file with no associated automated test harness. Manual verification:

  • Open the legacy Edit Content screen for a content type with a Tag field.
  • Add a tag with a long value (e.g. a really really really long tag value). Save and reopen.
  • Hover the truncated chip — verify the native browser tooltip shows the full value.
  • Repeat with a persona tag — verify same tooltip behavior.
  • Add a tag via the suggestion dropdown — verify the tooltip appears immediately without reload.
  • Click a chip — verify it is still removed (click-to-remove unchanged).
  • Verify the × close affordance still renders correctly.

Changed Files

  • dotCMS/src/main/webapp/html/js/tag.js — one-line addition in createTagLink()

Visual Changes

No visible layout changes. Behavioral change is the addition of a native browser tooltip on hover.

@github-actions github-actions Bot added Area : Backend PR changes Java/Maven backend code Area : Frontend PR changes Angular/TypeScript frontend code labels Apr 30, 2026
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 30, 2026

Claude finished @oidacra's task in 1m 27s —— View job


PR Review

  • Gather context
  • Read changed file and diff
  • Provide review feedback

Findings

The PR description is inaccurate — this is not a one-liner.

The description states "This adds a single node.title = ... assignment inside createTagLink()", but the actual diff is +20/-1 and adds two additional code blocks: dijit.Tooltip creation in addTagLink() and tooltip destruction in clearTag(). The acceptance criteria also say "native browser tooltip (title attribute)", but in practice the native title never persists — see below.


The dijit.Tooltip path removes the native title attribute.

In addTagLink() (tag.js:456):

node._tagTooltip = new dijit.Tooltip({ ... });
node.removeAttribute("title");   // ← undoes what createTagLink() just set

This means the one-liner in createTagLink() (tag.js:514) adds node.title, but it's immediately stripped whenever dijit is available — which is always on the legacy DOJO Edit Content screen. The acceptance criterion "native browser tooltip" is therefore not met by this code; it uses a dijit overlay instead. That's a design inconsistency between the stated goal and the implementation.

If the intent is a dijit tooltip, the node.title line in createTagLink() is superfluous noise. If the intent is a native tooltip, the entire addTagLink() block is wrong.

Fix this →


Silent error swallowing in clearTag() (tag.js:494).

try { e.target._tagTooltip.destroy(); } catch (err) {}

Bare catch with no logging masks real failures. At minimum use console.warn consistent with the pattern directly above it in addTagLink().


Over-engineering. The minimal correct fix is exactly the one-liner the description claims was made. The dijit.Tooltip additions add ~15 lines of lifecycle management, a _tagTooltip property on DOM nodes, and a destroy step — none of which is required to satisfy the issue.

oidacra added 4 commits April 30, 2026 12:59
Native browser title tooltip is slow (~1.5s) and visually inconsistent
with the rest of the legacy admin. Layer dijit.Tooltip on top — it
appears quickly and matches the existing Dojo-styled tooltips. The
title attribute remains as a fallback when dijit is unavailable.

Refs #35519
Avoid showing both the browser-native and Dojo tooltips at the same
time. The title attribute is set first as a fallback; once the
dijit.Tooltip widget attaches successfully, remove the native title
so only the Dojo tooltip is shown.

Refs #35519
Move dijit.Tooltip creation from createTagLink() to addTagLink(),
after the chip is inserted into the DOM. Some Dojo versions register
hover handlers that behave inconsistently when connectId points at an
unattached node, which would silently break the tooltip while the
native title was already removed.

The native title is now a real fallback: it is set in createTagLink()
and only removed when the dijit.Tooltip widget attaches successfully.
On constructor failure the catch logs a warning instead of failing
silently.

Refs #35519
@oidacra oidacra marked this pull request as ready for review April 30, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI: Safe To Rollback Area : Backend PR changes Java/Maven backend code Area : Frontend PR changes Angular/TypeScript frontend code

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Legacy Edit Content: tag chips have no tooltip when truncated

1 participant