Description
Two related mobile issues with quick quote:
- On mobile Firefox/Android, double-tap to select a word then expand the selection — the quote popup only captures the initially selected word, not the expanded selection.
- On Android Chrome, attempting to expand a selection causes it to jump to the end of the page.
Root cause
In quickreply_plugins.js (line ~291), the initialization binds both touchstart and mousedown handlers:
if ('ontouchstart' in window) {
quickreply.$.qrPosts.on('touchstart', '.content', handleQuickQuote);
}
quickreply.$.qrPosts.on('mousedown', '.content', handleQuickQuote)
.on('mouseup', '.content', addQuickQuote);
Single-word capture: The touchstart handler fires immediately when the user starts touching, before the selection is expanded. The selectionchange listener teardown is bound to mouseup (line ~271), but mouseup may fire prematurely on mobile (when the user lifts their finger after the initial long-press), removing the listener before the user finishes adjusting selection handles.
Selection expanding to end of page: On mobile devices that emit both touch and mouse events, handleQuickQuote fires twice (once for touchstart, once for synthetic mousedown), creating duplicate selectionchange listeners. Additionally, calling range.getClientRects() during an active mobile selection operation can interfere with the browser's native selection behavior.
Suggested fix
- Use only touch events on touch devices (skip mousedown/mouseup binding when
ontouchstart is available)
- Debounce
selectionchange handling
- Clean up
selectionchange listener on touchend instead of mouseup
References
Description
Two related mobile issues with quick quote:
Root cause
In
quickreply_plugins.js(line ~291), the initialization binds bothtouchstartandmousedownhandlers:Single-word capture: The
touchstarthandler fires immediately when the user starts touching, before the selection is expanded. Theselectionchangelistener teardown is bound tomouseup(line ~271), butmouseupmay fire prematurely on mobile (when the user lifts their finger after the initial long-press), removing the listener before the user finishes adjusting selection handles.Selection expanding to end of page: On mobile devices that emit both touch and mouse events,
handleQuickQuotefires twice (once fortouchstart, once for syntheticmousedown), creating duplicateselectionchangelisteners. Additionally, callingrange.getClientRects()during an active mobile selection operation can interfere with the browser's native selection behavior.Suggested fix
ontouchstartis available)selectionchangehandlingselectionchangelistener ontouchendinstead ofmouseupReferences