fix #10333 Tool-tip Closes using Keyboard in Table - #10363
Conversation
snowystinger
left a comment
There was a problem hiding this comment.
How did you arrive at this solution? What alternatives did you consider?
What other reasons might a user invoke scrollIntoView where the tooltip should close? Do we really want this to blanket ignore all?
|
Hi @snowystinger, Thanks for reviewing this. The main issue was that useCloseOnScroll treats every nearby scroll as a user scroll. But components like Table and GridList call scrollIntoView themselves during keyboard navigation, so those internal scrolls were also closing the tooltip. I first thought about ignoring scrolls after a focus event, but that doesn't work because the scroll listener is added only after the overlay opens. I also tried ignoring all scrolls for a short time after scrollIntoView, but that was too broad and broke existing tests. So I changed the approach. Instead of ignoring every scroll, the code now tracks only the specific scroll container that was scrolled by scrollIntoView. useCloseOnScroll ignores only those scroll events, and we shouldn't ignore every scrollIntoView call. The current implementation doesn't do that anymore. An unrelated scrollIntoView from another component won't prevent a Tooltip, Popover, or Menu from closing, and I added a regression test to verify that behavior. |
Closes #10333
✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project: