Homec4science

Don't mutate DOM by showing a tooltip on touch events

Authored by Alexander Ljungberg <aljungberg@slevenbits.com> on Feb 19 2016, 14:06.

Description

Don't mutate DOM by showing a tooltip on touch events

Summary:
This fix further addresses T10229. The problem and solution are the same:

  • If the DOM is mutated during a touch, it never registers as a 'click' so the tapped button does not activate.
  • This was partially addressed in D15136, which covered taps on code lines in a Differential view.
  • Tapping on some buttons, like "Reply" or "Hide Comment" still caused the problem by showing a tooltip.
  • There are probably similar buttons elsewhere, other than in Differential, exhibiting the same 'needs multiple taps to work' behaviour.
  • The testing in the iOS simulator performed for D15136 did not reveal that the problem with "Hide comment" and such remained because the small device size used for testing triggered the != 'desktop' path for tooltips.

To fix it:

  • Don't show tooltips for touch events. You can't 'hover' with a finger (with today's tech) so that UI paradigm doesn't apply.
  • Show the tooltips for regular mouse events, even if they are on the same device. Some devices have both touch and a mouse.
  • No longer try to rely on a distinction between 'desktop' and 'mobile' devices. Mobile devices like the iPad Pro are essentially desktop like, and as mentioned above, a single device could be both touch and mouse enabled. It's not about the nature of the device, it's about the nature of the interaction.

Test Plan:

  • Tapped "Hide Comment", "Reply" on an iPad Pro running iOS 9.2 and got single touch responses with no tooltips.
  • Tried the same on an iPhone 6 running iOS 9.2.
  • Hovered over the same on a regular desktop in Safari and saw tooltips. Clicked and saw regular reactions.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D15310

Details

Committed
epriestley <git@epriestley.com>Feb 19 2016, 14:06
Pushed
aubortJan 31 2017, 17:16
Parents
rPH5eecff91cdd3: Move Diffusion ReadmeView to PHUIDocumentProView
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPH4e40b17acae3: Don't mutate DOM by showing a tooltip on touch events (authored by Alexander Ljungberg <aljungberg@slevenbits.com>).Feb 19 2016, 14:06