Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: hide tooltips when scrolling on mobile #23098

Merged

Conversation

AndrewPrigorshnev
Copy link
Contributor

@AndrewPrigorshnev AndrewPrigorshnev commented Aug 15, 2023

This fixes the problem reported in https://meta.discourse.org/t/custom-status-message-in-front-of-by-header-on-scroll/273320.

This problem can be reproduced with any tooltip created using the DTooltip component or the createDTooltip function.

The problem happens because the trigger for tooltip on mobile is click, and for tooltip to disappear the user has to click outside the tooltip. This is the default behavior of tippy.js – the library we use under the hood.

Note that this PR fixes the problem in topics, but not in chat. I'm going to investigate and address it in chat in a following PR.

To fix it for tooltips created with the createDTooltip function, I had to make a refactoring. We had a somewhat not ideal solution there, we were leaking an implementation detail by passing tippy instances to calling sides, so they could then destroy them. With this fix, I would have to make it more complex, because now we need to also remove onScrool handlers, and I would need to leak this implementation detail too. So, I firstly refactored the current solution in 5a4af05 and then added onScroll handlers in fb4aabe (cc @jancernik).

When refactoring this, I was running locally some temporarily skipped flaky tests. Turned out they got a bit outdated, so I fixed them. Note that I'm not unskipping them in this commit, we'll address them separately later.

@github-actions github-actions bot added the chat PRs which include a change to Chat plugin label Aug 15, 2023
@AndrewPrigorshnev AndrewPrigorshnev force-pushed the feature/hide-d-tooltip-when-scrolling-on-mobile branch 4 times, most recently from 1f781f9 to fb4aabe Compare August 15, 2023 15:18
@AndrewPrigorshnev AndrewPrigorshnev changed the title feature/hide d tooltip when scrolling on mobile FIX: hide tooltips when scrolling on mobile Aug 15, 2023
@AndrewPrigorshnev AndrewPrigorshnev marked this pull request as ready for review August 15, 2023 19:33
@discoursebot
Copy link

This pull request has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/custom-status-message-in-front-of-by-header-on-scroll/273320/11

@AndrewPrigorshnev AndrewPrigorshnev force-pushed the feature/hide-d-tooltip-when-scrolling-on-mobile branch from 29a484b to fd7b4f3 Compare August 15, 2023 19:49
@jjaffeux
Copy link
Contributor

As I told you I will most likely replace most of this soon, but that's a good use case for me to check.

@AndrewPrigorshnev AndrewPrigorshnev force-pushed the feature/hide-d-tooltip-when-scrolling-on-mobile branch from fd7b4f3 to 4226a5e Compare August 23, 2023 11:12
@discoursebot
Copy link

This pull request has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/custom-status-message-in-front-of-by-header-on-scroll/273320/17

@AndrewPrigorshnev AndrewPrigorshnev merged commit 9c0e50e into main Aug 23, 2023
13 checks passed
@AndrewPrigorshnev AndrewPrigorshnev deleted the feature/hide-d-tooltip-when-scrolling-on-mobile branch August 23, 2023 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chat PRs which include a change to Chat plugin
3 participants