Re: [w3c/selection-api] setPosition/collapse should taken an optional argument for whether the caret is before or after a line break (#51)

rubywwwilde left a comment (w3c/selection-api#51)

@marijnh But is there a way to know if caret in the browser is before or after line break?
Now I know how to set it properly, but how do I know where was it set to?

I cannot trust "onselectionchange", it does not give me any useful information for such identification. Therefore it seems like I need to keep track of this parameter separately and do all the selection changes in browser myself. That works well when user changes selection with keyboard, but not when they change it with mouse. 

Does it mean that I need to keep track of pointer events to figure out if user clicked on the place that is at the new line or at the start of the previous line? That sounds incredibly ugly :)

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/selection-api/issues/51#issuecomment-3309283553
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/selection-api/issues/51/3309283553@github.com>

Received on Thursday, 18 September 2025 19:24:42 UTC