-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
A use case for cursor control for number inputs #2358
Comments
This is not a use case, so I'll ignore it.
This is a good use case. But, it's already possible! That is, it's already possible for all "input types that support behavior dependent on the cursor position".
This is a good use case too. It's best addressed by CSS, which allows you to style certain parts of controls. Again, it only applies to controls which necessarily have cursors and selection. |
Stepping back a bit, both of your examples seem to derive from wanting to present the user with a very specific experience, where text selection is present and the page author uses the selected text in various ways. If this is desired, then For the case of such specific experiences, you're much better off with |
@domenic these use cases came from people using syn to test behavior they already wrote. I'm advocating a bit here on their behalf. I don't have control over the types of controls people use. Would you consider mimicking user interactions for testing and playback a valid use case? Consider recording and simulating an interaction like:
The only way to make this work would be to model the behavior of
Similar care would be needed to play back the users action. If these actions are logged and played back, I couldn't see the cursor positioning changing. If a user can do something, I feel I should be able to programmatically put them back in the same state. As the complete interact-able state of a control isn't exposed, we could never, for example, present the user with their last cursor position after refreshing the page.
Would it be possible to make cursor and selection APIs available within controls that do have cursors and selection? Let developers feature test? Thanks again! |
For sure! That sounds like a good thing to work on as part of the webdriver project or other browser automation tools. I'm not very familiar with them myself...
Yes! That's already the case. But input type="number" is not one of those controls. |
Yeah, I've been working on I wasn't being clear with:
There is a cursor in desktop chrome / ff on Where browsers have a cursor selection on text within Thanks! |
You should create a new issue on a different project, like webdriver, that is dedicated to browser automation. It's not an issue for the HTML spec, or for HTML APIs; browser automation is not what we design HTML APIs for.
This is the case, I'm sorry to say. Otherwise it's too easy for sites to start depending on the behavior in popular browsers, thus painting us into a corner and preventing further evolution. As @Hixie said in https://www.w3.org/Bugs/Public/show_bug.cgi?id=24796#c24,
|
Probably a few years late but it worked by turning the field type to text first then turn in back to number again. |
@Ballpin Thanks. Amazing solution! |
I would like to advocate for an API allowing programatic control and access of the cursor position for any input types that support behavior dependent on the cursor position.
A simple example might be changing the
number
inputs to useArrowUp
andArrowDown
keys to change a selected number in the range instead of only adding or subtracting1
.This still works in Safari 9.1.2 as follows:
http://jsbin.com/juzepovowi/1/edit?js,console,output
Other uses of supporting some type of selection might be to show users some additional information about what is selected. For example, with long numbers it can be difficult to tell what an individual number represents. With the cursor, we could help with something like:
Thanks for your consideration.
The text was updated successfully, but these errors were encountered: