[Webkit-unassigned] [Bug 138201] Caret doesn't move while scrolling -webkit-overflow-scrolling: touch content on iOS

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Oct 16 17:03:24 PDT 2018


https://bugs.webkit.org/show_bug.cgi?id=138201

--- Comment #36 from Chet Corcos <ccorcos at gmail.com> ---
I have a really hacky solution that appears to work in the meantime. It takes a toll on performance though :/


```
import * as raf from "raf"

let elm: HTMLDivElement | undefined

function getElm() {
        if (!elm) {
                elm = document.createElement("div")
                elm.style.position = "fixed"
                elm.style.top = "-9999px"
                elm.style.left = "-9999px"
                elm.style.zIndex = "-9999"
                document.body.appendChild(elm)
        }
        return elm
}

let pendingRender = false

function forceRerender() {
        if (pendingRender) {
                return
        }
        pendingRender = true
        raf(() => {
                pendingRender = false
                getElm().style.height = Math.random() + "px"
        })
}

function rerenderSelectionCaret() {
        if (window.getSelection().anchorNode) {
                forceRerender()
        }
}


// get your scroller element
scroller.addEventListener("scroll", rerenderSelectionCaret)
```

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20181017/5fbf62df/attachment.html>


More information about the webkit-unassigned mailing list