Skip to content

Fix interaction candidate lookup when using animation target positions - #12359

Open
hakarrr wants to merge 2 commits into
chartjs:masterfrom
hakarrr:fix/final-position-interaction-lookup
Open

hakarrr wants to merge 2 commits into
chartjs:masterfrom
hakarrr:fix/final-position-interaction-lookup

Conversation

@hakarrr

@hakarrr hakarrr commented Oct 25, 2026

Copy link
Copy Markdown

Problem

getElementsAtEventForMode(..., true) asks interaction modes to use final animation positions, but candidate pruning still binary-searches current element pixels. A point moving away from its current neighbors can therefore be excluded before its target position is hit-tested. The later inRange(..., true) call cannot recover a pruned point.

Change

Pass the final-position flag through candidate evaluation. For sorted index-axis data, binary-search element target coordinates via getProps instead of current coordinates. The existing current-position path is unchanged. The target search remains logarithmic and does not allocate a full target-coordinate array.

Twenty regression scenarios use real Chart.Animation instances with ordered targets across x/y index axes, reversed scales, and point/nearest/index/dataset/axis modes. Eight fail against unchanged base 71d4421; all twenty pass with the change. The tests also check that current-position queries do not return a point only intersecting at its target.

Validation

  • 68 interaction tests pass in Chrome Headless.
  • Full Karma suite: 1723 tests pass in Chrome Headless.
  • Rollup build and TypeScript declaration emit pass.
  • Changed-file ESLint has zero errors. The existing binarySearch complexity warning remains (15 versus 14 on base).

Tested in a separate exact-base tree without #12358's reversed-intersection fix. This addresses final-position lookup, not that independent range-order bug. Firefox was not run; its executable is unavailable in this environment. Package integration suites were not run.

hakarrr and others added 2 commits October 25, 2026 23:12
Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>
Co-authored-by: generaltony007 <144252170+GeneralTony007@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

1 participant