#7948 Cursor position often wrong in new markdown editor

v1.3.2
closed
General
2015-08-24
2015-08-03
No

When editing text in the new markdown editor, the cursor can be off by a line (or few?). This seems to happen reliably, but exact cause is not narrowed down yet. Seems to only be when editing existing content, not when creating new content (even pasting the exact same text). I think it has to do with the initial height of the input area being tall. Sometimes I can get the cursor to work properly again if I add or delete enough rows to make the textarea resize some amount.

Related

Tickets: #7950

Discussion

  • Igor Bondarenko - 2015-08-04
    • assigned_to: Igor Bondarenko
     
  • Igor Bondarenko - 2015-08-06

    I've narrowed down the bug, but still have no idea how to fix it :(

    The bug is caused by SimpleMDE itself or by 'gfm' (markdown) mode of CodeMirror when lineWrapping is enabled and you have particular pattern of lines and actions. I.e. first line is exactly as long as the editor, so typing next symbol will wrap the line, and the second one is longer, so it is wrapped already. Plus, you must have some long text before and after it.

    Plain CodeMirror does not have it and I was not able to create a jsfiddle with CodeMirror + 'gfm' mode yet (see github issue below).

    Opened an issue for SimpleMDE https://github.com/NextStepWebs/simplemde-markdown-editor/issues/39

    Maybe someone will shed a light on it...

     
  • Dave Brondsema

    Dave Brondsema - 2015-08-10
    • labels: ux, sf-current --> ux, sf-current, sf-4
     
  • Igor Bondarenko - 2015-08-11
    • status: open --> review
     
  • Igor Bondarenko - 2015-08-11

    Closed #835. ib/7948

    Updated SimpleMDE to 1.5.0 and it fixes the issue for me.

    Full screen mode has been added in this version. I've changed some css for it to work and it works fine on the ticket edit for example, but it it doesn't currently work for comments due to this bug.

    We can disable full screen until it fixed or just wait a bit, seems like SimpleMDE's maintainer reacts pretty quickly :)

     
  • Igor Bondarenko - 2015-08-11

    I guess we can wait a bit, since the issue is already fixed, and 1.5.1 will be released soon

     
    • Dave Brondsema

      Dave Brondsema - 2015-08-12

      Yeah 1.5.1 is out now, want to update to that before we close out this ticket?

       
  • Igor Bondarenko - 2015-08-13

    Updated to 1.5.1.

    There's one problem, though. If artifact has a few of comments/replies and you're trying to edit one of them in full screen mode, some of them will overlap the editor, ignoring it's (higher) z-index.

    Basically, the problem is that each comment's "div.row" creates new stacking context by using:

    position: relative;
    z-index: 0 /* or 1 for parent */
    

    The editors are inside these contexts, it means that editors in stacking contexts closer to the bottom of the stacking order can't appear in front of an element in a different stacking context that is higher in the stacking order, no matter what z-index is used. This article really helps in understanding that.

    The reason we have z-index for each comment is that our top-level comments have darker border color than replies, so we need to put replies to the bottom of stacking order, so that top border wouldn't overlap with a parent comment's bottom border.

    If we're feeling fine making border color of the replies the same as top-level comment's, then we can fix the issue (see commit 615d4d0). If not we're better off disabling full screen mode I think.

    I've tried to keep colors as is and fix border overlap without using z-index, e.g. setting border-top-color: transparent; for replies but it looks bad.

     
    • Dave Brondsema

      Dave Brondsema - 2015-08-13

      I think I got it to work. What do you think of [9873e2] on db/7948?

       
    • Dave Brondsema

      Dave Brondsema - 2015-08-13

      And another commit on db/7948 to make fullscreen not have a max-height

       
      • Igor Bondarenko - 2015-08-14

        Nice fix Dave! Looks good to me

         
  • Dave Brondsema

    Dave Brondsema - 2015-08-14
    • status: review --> closed
    • Reviewer: Dave Brondsema
     
  • Dave Brondsema

    Dave Brondsema - 2015-08-24
    • labels: ux, sf-current, sf-4 --> ux, sf-4
     
  • Dave Brondsema

    Dave Brondsema - 2015-12-08
    • Milestone: unreleased --> v1.3.2
     

Log in to post a comment.