[wp-trac] [WordPress Trac] #31661: Quicktags: Can't add them using just a keyboard in IE

WordPress Trac noreply at wordpress.org
Sun Mar 29 18:04:18 UTC 2015


#31661: Quicktags: Can't add them using just a keyboard in IE
----------------------------------+----------------------------------------
 Reporter:  Cheffheid             |       Owner:
     Type:  defect (bug)          |      Status:  new
 Priority:  normal                |   Milestone:  Awaiting Review
Component:  Editor                |     Version:  4.1
 Severity:  normal                |  Resolution:
 Keywords:  has-patch needs-      |     Focuses:  accessibility, javascript
  testing                         |
----------------------------------+----------------------------------------

Comment (by afercia):

 Thanks very much Jeff :) so let's summarize

 All modern browsers support `selectionStart/End`
 IE 11 supports `selectionStart/End` and `window.getSelection`
 IE 10 and 9 are in a "mixed" situation and support `selectionStart/End`,
 `window.getSelection` and `document.selection`
 IE 8 supports just `document.selection`

 Please consider `window.getSelection` is not intended for input and
 textareas, and for sure it doesn't work in Firefox, see
 https://bugzilla.mozilla.org/show_bug.cgi?id=85686

 > It's why I ended up storing the selection's start and end in an array
 when the getSelection() check returns true and the reverse tab out of the
 textarea happens :).

 Sure that's what we should do :) but maybe we shouldn't check for
 `getSelection()` ? I'd say to reverse the logic, modern browsers first and
 at this point maybe use the stored values for all browsers:

 {{{
 // on reverse tabbing store proper values for all browsers: maybe we could
 use just one array
 // with values for canvas.selectionStart, canvas.selectionEnd,
 document.selection.createRange()

 if ( canvas.selectionStart || canvas.selectionStart === 0 ) {
     // true for IE 11, IE 10, IE 9 and modern browsers
     check if there are stored startPos and endPos and use them
     or fallback to canvas.selectionStart and canvas.selectionEnd
     ...
 } else if ( document.selection ) { // now this is just for IE 8
     use the stored keyboardSelectionIE or fallback (see previous patch)
     ...
 }
 }}}
 Thoughts?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31661#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list