-
Notifications
You must be signed in to change notification settings - Fork 40
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
How do we switch the caret between overtype and insert mode? #55
Comments
If by overtype mode you mean that each newly typed character replaces one existing character: I don't think that even exists on Mac or iOS; I don't know on which other platforms it does exist. I also have no idea how it would work for languages with more complicated character models, such as Hindi. Do you have more information on that? |
@NorbertLindenberg If you are on a PC (Windows/Linux), and you click the "Insert" key, you will notice that in most applications you now have a caret that will let you do as you described above. This works in most editors where contenteditable is used. |
Yuk. (Yeah, I know over overtype mode). Honestly, I would love to say "you overtype if there is something selected, otherwise the mode doesn't exist". What would that break in practice? |
Is there anything else affected by the mode apart from BTW, on Mac there’s no overtype globally, but it’s sometimes supported on application level (vi, Brackets). |
To me personally the overtyping mode is mainly just annoying, similar to "Caps lock". It's just a key one hits accidentally and usually ends with one having to rewrite part of the text. But given that it's there, and people use it for something, we probably cannot just discard it altogether. |
Actually, I think we could discard it. While people use it, I'd be surprised if its a really important feature. I'd love to hear from anyone who has actual usage statistics… |
I agree. Although I also agree that it could be annoying, it’s still used by some. Do I understand correctly that on Windows/Linux overtype is a system-wide feature that applies to any input? If so, dropping it is a no go, as developers expect system-wide features to work system-wide. On typing container, that could be something like |
Indeed, it works just about everywhere and it works in contenteditable. An exception are text input boxes like the github one I'm typing in right now, that were built from the ground up in JavaScript where the authors of that particular JS library decided not to support it.
Sure, what's your suggestion to do then? |
Then I’m sure we should not discard it. If we decide we don’t want to use a global namespace for that, we just stick with string identifiers: e. g. In case of strings, I think pros and cons of constants are clear by now, so I’m interested in what others may think. |
I don't think that's the right criterion to use. The contentEditable="typing" is a new self-contained block of functionality, and will be used to create new applications, so this is the right time to revisit some old assumptions about requirements. A more interesting question is "how many people are going to miss overtype if it's not there, and for how long?". I understand that's also a harder question to answer, but without that kind of question our computers would all still have floppy disk drives. |
I feel strange advocating a feature I don’t use. Just a reminder: if we drop it, cE=typing will be the only control not responding to system-set typing mode. At the same time, I now think what I wrote above is broken/incomplete for the reason we never discussed. What happens on a platform that does not support overtype? Does the fact that we expose a specific method mean we require all UAs to implement overtype internally, regardless of system-wide support? (I hardly imagine overtype on iPhone, let alone wearables or whatever may come tomorrow.) If not, and UAs are assumed to use system-implemented input, do we need an exposed method at all, or should UAs handle that internally (‘inherit’ from system settings, set their own input mode) and only change In my opinion, we shouldn’t require overtype support. It may be a good feature, a bad feature, but it’s certainly not essential for the ability to type (there was no ‘Insert’ key on NeXTSTEP in CERN). We also don’t want a platform-specific method. I’m inclined to drop the method, but keep support for Now, that may sound like more platform-specific behaviour; but it’s the opposite. Neither overtype support nor lack thereof affects what happens, only how. Sorry for being verbose. |
Yes, they need to support overtype if they want to implement the spec entirely. The idea with the spec is that editor developers know exactly what does and can happen in the editor. Given that Chrome has overtype support, I assume that also Safari has it, and that Mac user just don't access it because they don't have the needed We could add some wording about "If the UA supports overtyping then it MUST..." That would make it possible to implement the spec without supporting overtype in the UA. I doon't necessarily think that is a good idea. It could mean someone creates a webbased VI-vlone, and it works everywhere except on Mac, where the overtype mode is just broken.
I tried it here on Linux, and setting overtype in one program did not enable it in other programs. What do you mean by "‘local’ input modes are not supported at all on a given system". Aren't we kind of defining how this input mode is working?
What we try to avoid here is the kind of magic that we currently have in contenteditable which led us into the mess we are currently in. The editor JS should under all circumstances know exactly know what is going on and figure out what to do with user intentions. So the user intention may be to enable overtype, but the JS editor needs to be able to figure out what to do with that request. |
@klimlee So I think that if the option is to have overtype happen "automagically" without any way for the JS editor to know about this or to interfere with it, I would vote for dropping overtype altogether. It can always be reintroduced in a later version of the spec. |
Agreed we want to avoid a mess that makes implementation harder. But this is basically a user-facing option and it is unclear whether users will be really upset if it disappears. In particular, I don't know what the use cases are beyond "deal with someone pressing the insert button on a 1980s keyboard"… What about:
And FWIW I believe the "modern style" for APIs is to use strings rather than numerical constants as identifiers for things like events. |
I have an insert-key on my 2015 Thinkpad. Mac OS X may be the most common OS among developers these days, but lets not forget that there are still many people running Windows in this world.
Right now we have a beforeInput event for this, that lets us know about a user's "intentions".
Right now, there is no default behavior for all or most of the events within ContentEditable=Typing that are marked as intentions. So it's just an event that a piece of JS may choose to hook in to. If nothign does that, nothing happens.
Yes, but for that they need to be able to show the overtype caret, so we need to make that possible. All movement and insertion is handled in JS, with the exception of some parts of IME-based insertion of new content. In that case it would have to look a bit different visually as the current character is covered during the composition process while in overtype mode. Thisis the entire reason overtype needs to be mentioned in the spec if it is supported. |
(Sorry, I know that most keyboards still have an ins key and that MacOS is actually a niche product. I'm just not sure that ins is a commonly used key any more). So we have the event requesting overtype... The most obvious way I can think of to handle the interaction seems to be that you select a character, when a character is typed it replaces that one and the next character is selected... that re-uses what we do in typing, provides a visual indicator that uses platform hooks which should be easier to make accessible than doing everything ourselves, … But of course it's vapourware in my head, not a working implementation. |
Thinking about it, you may be right, that could be a way to implement overtype in userspace. As for the silent failing: currently all events associated with an editor fail silently in contenteditable=typing: pasting, inserting a character, marking text as bold, etc. . Nothing works by default and no preventDefault() has to be issued on things one does not want to work. |
I’m not sure about that. But I believe mobile platforms don’t support overtype and never will. So we’re practically requiring UAs to polyfill a missing OS feature on their own.
Well, you can’t
I’m definitely not proposing that. I’m rather saying that the only thing overtype affects is the type of input events, not the nature of the input itself, and it always sets the intended |
The way you describe it, it sounds as if the UA simply lets the OS draw a text input window and then lets the OS deal with the caret. I am not an OS developer, but it is my understanding that it is the browser that does handles everything about text input. I am slightly unsure about the shape of the caret. Some comments at the last CSSWG meeting make me think that it is not entirely configurable by the browsers.
Ok, yes for input that should work. And if the "caret" in overtype mode simply is one character selected, then yes, I think this should be doable in userland. How to make sure that always one character is selected while in overtype mode will have to be handled in the JS. If caret movement is to be handled primarily by the UA (and not JS)< then it probably needs some definitions about how to move an overtype caret (as is discussed in #58 ). |
It depends on how you define "system-wide feature." It's not a feature like IME or Caps Lock where system holds a global state, and have APIs to manage it. On the other hand, most apps on Windows used to have the feature, including ones from MS. In that sense, one may call it a "system-wide feature;" available in every text edit in the system. However, it's also true that some MS apps started to get rid of the feature, such as MS Word. I just tried notepad on Windows 8.1 and it does not seem to work any longer. So I think what's important for now are:
To do that, I think we'll need MS reps to join the conversation. Maybe keep as an open issue, mark in the spec, and go on? |
Off-topic, but till important:
I think I've written to all major editing libraries about the editing task force. The two big ones (TinyMCE and CKEditor) have been active in the discussion here on Github. Aloha Editor was at the Xtensible Web Summit in Berlin last year where several of us met for the first time, but they were already well on their way to create their new 2.0 editor which is not based on contentEditable. The Wikimedia Visual Editor people have briefly been active on the email list. Also the Codemirror main developer is aware of this effort. And then there are the Google and Microsoft teams with their various online editors who have not been directly active here, but at least the Microsoft people spoke through Benjamin earlier. Maybe we should try to write to some of them again now that there is more of a solid proposal. |
The spec already talks quite a bit of overwrite vs. insert mode. Now I am thinking maybe we should just remove the overtype part for now and just add it as an issue that can be added in a future version. |
…y be handled entirely by JS code, but add an issue about it, relates to #55
What method should we use to switch between the caret in insert and overtype mode?
The text was updated successfully, but these errors were encountered: