fix(CTooltip,CPopover): cancel pending delay timers and preserve child handlers#465
Merged
Merged
Conversation
…d handlers - track the show/hide timeout in a ref and clear it on every show/hide transition, so re-hovering during the hide delay no longer dismisses a visible tooltip/popover and leaving before the show delay elapses no longer flips internal state for an unmounted one - clear the pending timer and destroy the popper instance on unmount - compose cloned child event handlers (onClick, onFocus, onBlur, onMouseEnter, onMouseLeave) instead of overriding them
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
handleHidescheduled asetTimeoutthat was never cancelled. Re-hovering the toggler during thedelay.hidewindow still dismissed a visible tooltip/popover under the cursor. Symmetrically, the show timer kept running after the pointer left, flipping internal_visiblestate (andaria-describedbyon the toggler) for a tooltip that was no longer mounted.cloneElementreplaced the child's ownonClick/onFocus/onBlur/onMouseEnter/onMouseLeaveinstead of composing them — a silent, hard-to-diagnose bug for consumers.Changes
[mounted]effect won't re-fire.ReactElement<HTMLAttributes<HTMLElement>>instead ofany(also clears a pre-existingno-explicit-anylint error on these lines).Tests
5 new regression tests (3 tooltip, 2 popover): re-hover during hide delay keeps it visible, leaving before the show delay cancels the pending show (incl. no stray
aria-describedby), and child handlers still fire. All 5 fail againstmain, pass with the fix. Full suite: 127 suites / 353 tests green, no snapshot changes.