3

This just started happening to me yesterday (and has been reproduced): if I start to edit a post on a site where I have edit privileges, which means I'm using the inline editor, then the edit cursor is positioned at the end of the post instead of the beginning. On the other hand, if I start to edit on a site where I don't have such privileges, which means the site loads a new page for editing, the cursor is positioned at the beginning where I expect it.

Some test cases:

  • Edit any post on a site where I have the edit privilege: inline editor, cursor at end.
  • Edit my own post on a site where I don't have the edit privilege (but you can always edit your own posts): new page, cursor at beginning.
  • Edit any post while not logged in: new page, cursor at beginning.

I'm using Firefox 51.0.1 on Windows 7. Two other people have reproduced this in Firefox (specifics unknown). We don't yet have observations for other browsers.

(Thank you TL denizens for help in characterizing this bug.)

9
  • Norepro in Firefox ESR (45.7) or in Chrome 56. Feb 2, 2017 at 23:52
  • AFAIK Firefox started putting cursors at the end of inputs, contrary to convention starting from 51.
    – Andrew Li
    Feb 3, 2017 at 0:11
  • @Andrew then shouldn't both edit interfaces be affected? Feb 3, 2017 at 0:13
  • @MonicaCellio That's what I'm trying to figure out
    – Andrew Li
    Feb 3, 2017 at 0:14
  • While I don't think it's objectively worse to default to the end instead of the beginning, it is annoying to deal with when you've been used to the opposite. I keep opening up the edit window, trying to scroll to the bottom, and scrolling the whole page by mistake because of course there's no further to scroll within the edit box. Feb 3, 2017 at 1:26
  • 1
    Same question on MSO: meta.stackoverflow.com/questions/342386/… (cc @Shog9)
    – Stijn
    Feb 3, 2017 at 15:36
  • 1
    You can use this script that Tiny Giant wrote meta.stackoverflow.com/a/342430/1415724 but I can't say if it works on (Google) Chrome since I don't use that. It works for FF 51+ though. Feb 3, 2017 at 15:57
  • @Fred-ii- Chrome isn't currently broken, so no need to change anything there. (Chrome and Firefox are now inconsistent for me in this way.) Thanks for the pointer to the userscript. Feb 3, 2017 at 16:04
  • @MonicaCellio You're welcome Monica. Feb 3, 2017 at 16:05

2 Answers 2

3

This is due to Firefox's choice of "fixing a bug" in version 51. Per the MDN:

  • The <input> and <textarea> elements' selectionStart and selectionEnd attributes now correctly return the current position of the text input cursor when there's no selection, instead of returning 0 (bug 1287655).

So, Firefox 51 now sets the cursor to the end of the text. This isn't the same for the other editors because they aren't focused like they are when you're logged in and editing. You could probably use a userscript to fix this.

4
  • Followup question (before resorting to a userscript): superuser.com/q/1174680/96202 Feb 3, 2017 at 2:03
  • @MonicaCellio With tag: in title? Didn't expect that from you.
    – user315433
    Feb 3, 2017 at 3:09
  • 1
    @zaq I wasn't thinking of it as a tag when I wrote the post (title first, then body, then tags), but about the application that my question is about. I started out with something like "In Firefox, how do I..." and then decided that was wordy. But also, I'm a big fan of having essential info in the title, which is the first thing people see. Feb 3, 2017 at 3:11
  • Can you figure out what changed since I can't reproduce it anymore and the dev-changelog doesn't give hints?
    – Braiam
    May 7, 2017 at 13:26
3

Behavior does not appear in Chrome (Windows or Android), or in Firefox 50.1.0 on Windows 10. I do observe the behavior in Firefox 51.0.1, thus suggesting this is either intended behavior or a bug in Firefox.

As for the two different editors: if you don't get the inline editor, the textarea doesn't have focus by default (either the title editor has focus - and the cursor at the end - or nothing has focus if there's no title). You can observe the same behavior in both the inline and full-page editors if you give focus to the body editor by tabbing.

10
  • Not a bug, but a bug fix. Instead of having 0 for selectionEnd and selectionStart by default (bug), it now conforms to the content and thus the cursor goes to the end of the text. (See MDN, bug 1287655.)
    – Andrew Li
    Feb 3, 2017 at 0:46
  • Yeah, just found Bug 1287655 - still reading, since I'm not entirely clear on why that would be desired behavior.
    – Shog9
    Feb 3, 2017 at 0:48
  • @Shog9 any idea how the editor-browser interaction would differ between the two editors? That it only happens with one of them is peculiar, and makes me wonder if there is something that can be done at our end to prevent the bad behavior. Feb 3, 2017 at 0:50
  • It definitely goes against "convention", but there's no set specification for where the cursor is placed. I personally like that it now correctly sets the selections.
    – Andrew Li
    Feb 3, 2017 at 0:51
  • @MonicaCellio By the looks of it, the textarea isn't focused when I'm logged out.
    – Andrew Li
    Feb 3, 2017 at 0:51
  • @AndrewLi when I want to interact with some text on the web, I generally want to start at the beginning. But we don't need to argue about whether Firefox introduced or fixed a bug; is there a way that either SE or a user can restore the previous behavior? Feb 3, 2017 at 0:52
  • If you don't get the inline editor, the textarea doesn't have focus by default @Monica (either the title editor has focus - and the cursor at the end - or nothing has focus if there's no title). You can observe the same behavior in both the inline and full-page editors if you give focus to the body editor by tabbing.
    – Shog9
    Feb 3, 2017 at 0:53
  • Oh I see; it's because the title (or nothing) has focus in the one editor and the body in the other. Feb 3, 2017 at 1:53
  • @MonicaCellio I can't reproduce it anymore. Shog, did something change at your end?
    – Braiam
    May 7, 2017 at 13:22
  • Bug fixed in Firefox 51, @braiam
    – Shog9
    May 7, 2017 at 15:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .