Page MenuHomePhabricator

Popup becomes visible for a fraction of a second if link was hovered when AJAX request gets triggered
Closed, ResolvedPublic2 Estimated Story Points

Description

If you hover over a link and keep mouse pointer over a link for 0.2-0.5s (probably till AJAX request is fired) and move mouse away (before popups becomes visible) - after request is made popup becomes visible for a fraction of a second and then gets dismissed.

Browser: Firefox
Expected scenario: no popup is presented to a user

Event Timeline

I'm not sure why this would've been introduced during the last sprint but it's actually fairly easy to fix: don't reduce FETCH_COMPLETE if the user has abandoned the link (state.isUserDwelling is falsy) in src/reducers/preview.js:

src/reducers/preview.js
switch ( action.type ) {
  case actionTypes.FETCH_COMPLETE:
    if ( action.token === state.interaction.token ) {
      /* ... */
    }
}

becomes:

src/reducers/preview.js
switch ( action.type ) {
  case actionTypes.FETCH_COMPLETE:
    if ( action.token === state.activeToken && state.isUserDwelling ) {
      /* ... */
    }
}

^ OK. That change doesn't fix the problem all of the time but it makes it very hard to trigger the condition.

ovasileva set the point value for this task to 2.Apr 20 2017, 5:17 PM
ovasileva moved this task from Needs Analysis to To Do on the Reading-Web-Sprint-96 board.
phuedx moved this task from To Do to Doing on the Reading-Web-Sprint-96 board.

Change 349410 had a related patch set uploaded (by Phuedx):
[mediawiki/extensions/Popups@master] Don't show preview when user abandons link

https://gerrit.wikimedia.org/r/349410

phuedx added a subscriber: bmansurov.

@bmansurov left a comment – without signalling that he'd commented. @bmansurov… – that's worth following up on because, as usual, he's correct.

I'll try better next time. Maybe I'll ping you on IRC or -1 the change. This time I just had a question.

Change 349410 merged by jenkins-bot:
[mediawiki/extensions/Popups@master] Don't show preview if user has abandoned link

https://gerrit.wikimedia.org/r/349410

Tested on beta cluster, works nice and smooth and it's pretty difficult to reproduce the original error (popups becomes visible and immediately disappears). Marking this task as solved. Good job @phuedx !