[dreamwidth/dw-free] 5c0b8c: [#2468] Make quote button work better on mobile (#...
Branch: refs/heads/develop
Home: https://github.com/dreamwidth/dw-free
Commit: 5c0b8c94e48e8d9a2a772b180ba2bfd3a75dfda6
https://github.com/dreamwidth/dw-free/commit/5c0b8c94e48e8d9a2a772b180ba2bfd3a75dfda6
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2019-05-31 (Fri, 31 May 2019)
Changed paths:
M htdocs/js/jquery.quotebutton.js
Log Message:
-----------
[#2468] Make quote button work better on mobile (#2469)
Fixes #2468.
The comment form quote button uses javascript to grab the current text selection
at the time the button was pressed. But touch-based mobile browsers smear the
timing of "pressed," such that the selection has usually been cleared by the
time the button's click handler fires. The user experience of that is basically
:trollface:. It sometimes works! Technically!
You can reliably fix this by retaining the last non-zero text selection and
quoting _that_ if the current selection is zero.
On mouse platforms, where text selection is an easy fidget behavior instead of a
slow and intentional command, there's a medium chance of doing the wrong thing
if someone fidget-selects for a while and then uses the quote button for the
first time. Luckily, the last two years of phone browsers all support CSS4 media
interaction features, so it's easy to only target platforms with slow-select.
Since every browser from the last seven years supports the W3C draft of the
selection API (including IE9!), this also seems like a good time to stop it with
that IE8 thing, especially since Microsoft themselves deleted their docs for it
and redirected the page to MDN's Selection docs. (#wow)
Home: https://github.com/dreamwidth/dw-free
Commit: 5c0b8c94e48e8d9a2a772b180ba2bfd3a75dfda6
https://github.com/dreamwidth/dw-free/commit/5c0b8c94e48e8d9a2a772b180ba2bfd3a75dfda6
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2019-05-31 (Fri, 31 May 2019)
Changed paths:
M htdocs/js/jquery.quotebutton.js
Log Message:
-----------
[#2468] Make quote button work better on mobile (#2469)
Fixes #2468.
The comment form quote button uses javascript to grab the current text selection
at the time the button was pressed. But touch-based mobile browsers smear the
timing of "pressed," such that the selection has usually been cleared by the
time the button's click handler fires. The user experience of that is basically
:trollface:. It sometimes works! Technically!
You can reliably fix this by retaining the last non-zero text selection and
quoting _that_ if the current selection is zero.
On mouse platforms, where text selection is an easy fidget behavior instead of a
slow and intentional command, there's a medium chance of doing the wrong thing
if someone fidget-selects for a while and then uses the quote button for the
first time. Luckily, the last two years of phone browsers all support CSS4 media
interaction features, so it's easy to only target platforms with slow-select.
Since every browser from the last seven years supports the W3C draft of the
selection API (including IE9!), this also seems like a good time to stop it with
that IE8 thing, especially since Microsoft themselves deleted their docs for it
and redirected the page to MDN's Selection docs. (#wow)