4 ms·
If you've ever used a textarea/contenteditable, read this.
- Turing_Machine 15y agoTab works okay in my latest (see profile) but I didn't use a plugin or anything like that. I just did: $iframeEditor.keydown(function(event) { if (event.which == 9) { event.preventDefault(); iframeDoc.execCommand('insertHTML',true,' '); }}); I agree, not that hard to solve (obviously your mileage may vary as to whether you might want to insert spaces (as shown), the number of spaces, just ignore it, do something else, whatever). You might also need to add a little bit of extra event-handling code to make it work in IE -- I don't know. Fortunately I only needed to support WebKit for this project. :-)
- Turing_Machine 15y agoApologies for the code formatting -- it looked good when I posted it, I promise. Heh.
- mooism2 15y agoYou need to... indent it. 2 spaces I think, maybe 4.
- Turing_Machine 15y agoThanks. I'll try that next time.
- mooism2 15y agoDo most people (non-programmers/sysadmins) use the tab key when writing text? I'm used to the tab key moving the focus to the next field. It would annoy me if on one website it didn't, I'm sure.
- sheraz 15y agoUpvoted, and I agree. Breaking tab functionality is a no-go on forms used for repetitive data entry. It is probably OK for a contact form and other WYSIWYG edit boxes, but please use it judiciously.
- dhaivatpandya 15y agoI use the tab key when shifting focus, but, for things like editors, you can't have it jumping around to shift focus. For things like forms, its fine.
- Tangaroa 15y agoThis behaviour comes from Windows and MacOS where the tab key was used to move between interface elements. The first browsers were built with the same widget toolkit that the operating systems provided. From the UI perspective of the these interfaces, the tab key is doing exactly what it is supposed to do and making it do something else would break user expectations. It annoys me too, but there is a reason for it.