mirror of
https://github.com/john-okeefe/foliate-js.git
synced 2026-09-09 11:29:14 -04:00
Don't scroll to anchor if caret's moved by pointer
In Safari, clicking on links triggers `selectionchange`. Since we do not move the caret when flipping through pages, when you have flipped to the next or previous pages and click on any link, it would take you back to the caret instead of activating the link. Note that the bug occurs in Safari 17 but not in WebKitGTK 2.46. Not sure if there's a way to fix this and still retain the "set anchor to caret on click" behavior. But I guess this behavior isn't really that essential, anyway. So removing it for now. Fixes #44
This commit is contained in:
+1
-1
@@ -596,7 +596,7 @@ export class Paginator extends HTMLElement {
|
|||||||
if (!sel.rangeCount) return
|
if (!sel.rangeCount) return
|
||||||
if (isPointerSelecting && sel.type === 'Range')
|
if (isPointerSelecting && sel.type === 'Range')
|
||||||
checkPointerSelection(range, sel)
|
checkPointerSelection(range, sel)
|
||||||
else if (isKeyboardSelecting || sel.type === 'Caret') {
|
else if (isKeyboardSelecting) {
|
||||||
const selRange = sel.getRangeAt(0).cloneRange()
|
const selRange = sel.getRangeAt(0).cloneRange()
|
||||||
const backward = selectionIsBackward(sel)
|
const backward = selectionIsBackward(sel)
|
||||||
if (!backward) selRange.collapse()
|
if (!backward) selRange.collapse()
|
||||||
|
|||||||
Reference in New Issue
Block a user