-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Having a matching selectend
event?
#146
Comments
When would we fire |
that will depend on what the user agent does currently to determine that selection/highlighting is done - i'm assuming browsers know when that's happening? at least for mouse this should be the case. for mouse: user presses left mouse button down on selectable content, for touch, assume it's similar in terms of finger down, dragging/highlighting, then finger up (when UAs then often show contextual options/tooltips to copy etc). though i can see that then in cases where users are given controls to then manipulate the selection range may lead to further need for more keyboard (with caret type browsing) is probably the one case i can think of where it's indeed not unambiguous - but perhaps UAs could implement a heuristic that does the timer/debouncing internally and fires a |
It's not the mousedown itself causes selectstart, it changes the selection and thus selectstart happens. It sounds weird when selectstart is only about the selection and selectend suddenly cares about the input devices. (I mean, at least Gecko works that way) |
if you're saying browsers currently don't know (internally) when a selection ended, then fair enough. i'm only describing what i observe from the outside here, not saying it should be tied to specific input devices |
I think it still makes sense to have this event in web dev POV, and probably doable since Gecko does track the cause of selection changes anyway. |
Are you talking about cancelling / clearing a selection?
If not, feel free to think of every selection change as an end. If you select a bit with your mouse, let go of the mouse or tap, or shift key, and then grow or shrink it, whether with more keyboard shortcuts or dragging the selection handles at the start/end of the selection further out or in (maybe your OS / device doesn’t support that?), it’s still changing, even if you walked away for a cup of coffee in-between.
|
purely for mouse use, once you release the mouse button you can't change the selection further with the mouse (at least in Windows and macOS browsers). but yeah, I can see that you can at least expand it if you then switch to keyboard. fair enough, seems that the mouse case is then the odd one out/special case where there is some form of defined "end" (if you stick purely to mouse). wonder if it's worth mentioning this in passing in the spec in some non-normative note, that just outlines the points above (i.e. there's not a defined "end" to a selection, as users can carry on expanding/manipulating their selection). otherwise, feel free to close this issue. |
A naive question, and there's probably a good reason why there isn't one already, but: would it make sense to also have a matching
selectend
event that fires once the user is done selecting something? Unless I'm misunderstanding, otherwise the process at the moment to work with the API is:selectstart
selectionchange
events (which will keep firing as long as the user is still in the process of making the selection)mouseup
,touchend
,pointerup
, etc to try and guess when the user finished), and then get the selected text with.getSelection()
The text was updated successfully, but these errors were encountered: