Skip to content

Quality: Inconsistent callback context for tooltip hide handler#2917

Open
tuanaiseo wants to merge 1 commit intoc3js:masterfrom
tuanaiseo:contribai/improve/quality/inconsistent-callback-context-for-toolti
Open

Quality: Inconsistent callback context for tooltip hide handler#2917
tuanaiseo wants to merge 1 commit intoc3js:masterfrom
tuanaiseo:contribai/improve/quality/inconsistent-callback-context-for-toolti

Conversation

@tuanaiseo
Copy link
Copy Markdown

Problem

tooltip.show invokes tooltip_onshow with this bound to the internal chart object ($$), but tooltip.hide invokes tooltip_onhide with this bound to the public chart instance. This inconsistency can break user callbacks that rely on a stable context and internal fields.

Severity: high
File: src/api.tooltip.ts

Solution

Call tooltip_onhide with the same context style used by tooltip_onshow (for example: this.internal.config.tooltip_onhide.call(this.internal)), and add a regression test asserting callback this consistency.

Changes

  • src/api.tooltip.ts (modified)

Testing

  • Existing tests pass
  • Manual review completed
  • No new warnings/errors introduced

…ide han

`tooltip.show` invokes `tooltip_onshow` with `this` bound to the internal chart object (`$$`), but `tooltip.hide` invokes `tooltip_onhide` with `this` bound to the public chart instance. This inconsistency can break user callbacks that rely on a stable context and internal fields.

Affected files: api.tooltip.ts

Signed-off-by: tuanaiseo <221258316+tuanaiseo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant