The German-Community-Wishlist team continues to run into an issue that feels more and more like it might be an actual blocker for several tasks we would like to work on, most notably T214693: Investigate why Page and Reference Previews interfere when footnote comes right behind link on English Beta Wikipedia, as well as T218765: Show referencePreviews on click.
Steps to reproduce: When quickly hovering a link to a page, leave the link, and quickly hover it again within the time limit of less than a second, no popup will be shown. We found this is always reproducible.
Chain of events:
- When hovering the link for the first time, one gets a "link dwell" event, as expected.
- Let the mouse quickly leave the link. This stops everything and triggers an "abandon start" event.
- When the mouse re-enters the link quick enough, the next event will be a second "link dwell". This will get a new token. The new token will make the code throw this second "link dwell" away, because it happens to touch the same link as the first "link dwell" and the code acts like the first "link dwell" will still be executed. But it won't.
- The "abandon start" from before was not finished yet, and did not got stopped. It triggers an "abandon end".
- No popup will ever appear.
Code responsible for this behavior:
- https://phabricator.wikimedia.org/diffusion/EPOP/browse/master/src/actions.js$226 is the only place in the entire codebase where a new token is generated.
- https://phabricator.wikimedia.org/diffusion/EPOP/browse/master/src/reducers/preview.js$37 checks if the link that triggered a "link dwell" action is different from the link that is currently present in the state. It only accepts a new token if the link is different. In the use-case described in this ticket the link is not different.
- https://phabricator.wikimedia.org/diffusion/EPOP/browse/master/src/actions.js$246 checks if the newly generated token was accepted and is now present in the state. Because of the check above the token was not accepted. The interaction is not accepted as a new one, and no fetch is ever triggered.
- https://phabricator.wikimedia.org/diffusion/EPOP/browse/master/src/actions.js$353 is another check for the token, this time in the "preview show" event. But this is not even relevant for this bug.
There are probably several ways to fix this issue by changing one of the lines of code listed above.