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. |
|
Thanks for the explanation. I do not think this is a solution we will want. Introducing timers usually results in more race conditions rather than it fixes. I don't have another idea at the moment. You're welcome to explore other ideas or we can close this until more avenues are suggested/thought through. In addition, I appreciate the enthusiasm with all the PRs and help, but there are currently 9 AI driven PRs open from you and it's really filling up my notifications with all the requests and merges. Can we merge main a little less frequently? We should also focus on the PRs you have open now and making them easier to review before we open more, it's hard to keep up at the moment. You may want to try out some suggestions from #10343 |
Closes #10333
✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project: