Skip to content

Fix: Tooltip position and classes shift after item is visited when _position is empty string #365

Description

@swashbuck

Subject of the issue
When a Hot Graphic item's _tooltip._position is an empty string (""), the tooltip renders correctly on first display but shifts position after the item is visited. The tooltip changes from is-bottom is-middle to is-bottom is-right. A related issue also affects _classes - runtime classes like is-active (added on hover) can be stripped by the same change handler.

Your environment

  • Framework: 5.55.2
  • Browser and version: All browsers
  • Device(s) and OS: All

Steps to reproduce

  1. Add a Hot Graphic component with tooltips enabled
  2. Set _tooltip._position to "" (empty string) on an item - or leave it present but empty via the authoring tool
  3. Observe the tooltip renders at bottom center (is-bottom is-middle)
  4. Click the pin to visit the item
  5. Observe the tooltip has shifted to bottom right (is-bottom is-right)

Expected behaviour
The tooltip should remain at bottom center after the item is visited, and runtime classes should not be stripped.

Actual behaviour
The tooltip shifts from bottom center to bottom right after the item is visited.

Root cause
In hotgraphicModel.js, the setUpItems() method resolves an empty _position to 'outside bottom middle middle' during initial tooltip registration. However, the child.on('change') listener spreads ...tooltip back into the tooltip model on every child attribute change (including _isVisited). When _position is "", this overwrites the resolved value with the empty string. The tooltip then falls back to TooltipItemView.js's default of 'outside bottom middle right' - a different default - causing the visible shift.

The bug only triggers when _position is present as an empty string. When the key is absent entirely (undefined), the spread produces no _position key and the resolved value is preserved.

Posted via collaboration with Claude Code

Metadata

Metadata

Assignees

Type

Fields

No fields configured for Bug.

Projects

Status
Recently Released

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions