1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed Insert -> Quote causes cursor to lose focus outside text box

Discussion in 'Resolved Bug Reports' started by Optic, Dec 23, 2014.

  1. Optic

    Optic Well-Known Member

    As per title, affects both the Quick Reply and full message editor.

    Steps to reproduce:
    1. Click Insert button on editor, and select Quote.
    2. Input cursor no longer appears in the text box.

    Seems to only affect Chrome and Opera.

    On Safari and Firefox this is working correctly.
    Last edited: Dec 23, 2014
    rafass and Liam W like this.
  2. Brogan

    Brogan XenForo Moderator Staff Member

    I mentioned to Mike a few days ago, I suspect it is a browser issue.
  3. Mike

    Mike XenForo Developer Staff Member

    I can confirm this happens, but I'm not sure I can actually fix it. It seems that programmatically focusing simply isn't working. I'm not clear what the problem is because it does actually work some times but not other times.
  4. Chris D

    Chris D XenForo Developer Staff Member

    I spent some time looking at this, and even tested in Chrome Canary in the hope that some sort of browser behaviour would be changing in upcoming versions, but sadly not, (yet).

    It is possible to reproduce the bug with any control that is activated from a drop down menu in the editor that doesn't load an overlay for additional input. So, font colour, size, font, align, insert quote, strikethrough.

    Anything activated not via a drop down menu works fine, e.g. bold, italic. underline etc.

    Also not affected is stuff in a drop down that loads a modal, e.g. code and spoiler.
    rafass and semprot like this.
  5. tom_mai78101

    tom_mai78101 New Member

    The bug report didn't say anything for Internet Explorer 11.

    I can confirm that IE11 works without the problem of defocusing the text cursor.
  6. Chris D

    Chris D XenForo Developer Staff Member

    We're pretty sure it only affects Chrome and Opera.
  7. batpool52!

    batpool52! Well-Known Member

    Found a small fix, I'm sure someone can come up with better fix and works only with QUOTE button.

    Open js/xenforo/full/bb_code_edit.js
    -removed previous fix-
    ed.$editor.on('focus click', function(e) {
                    if (blurTimeout)
                        blurTimeout = null;
    Add after:
    ed.$editor.on('focus', function(e)
                    if ($.browser.webkit) // zanpakuto is Webkit...
                            ed.focus(); // muramasa is forcing shinigami to get unfocused..
                        }, 100);
    Tested only on Google Chrome, Windows 8.1 Pro with Update 1 x64
    Last edited: Feb 26, 2015
    Chris D and Optic like this.
  8. Optic

    Optic Well-Known Member

    I've found a slight workaround. After doing Insert -> Quote, if you click another button that doesn't need an overlay (e.g. Bold/Italic/Underline) then the cursor returns to the correct focus point (inside the quote tags).


    So it seems the cursor position is in the right spot even after losing focus.
    batpool52! likes this.
  9. Rudy

    Rudy Well-Known Member

    Did this just recently start happening? I've noticed this as well, and I do not recall it happening before. I do not insert quotes manually all that often, but at least I know it's not me, doing something wrong as usual. :D It probably happened with some recent Chrome update.

    This affects other functions also. If I type a line of text, insert the cursor somewhere in the middle of that line, then go to align it left/center/right with the editor button, the text aligns properly but again, focus is dropped. If I do this in IE, the cursor remains where I left it.

    A clash between the editor and Chrome apparently, and not limited to the quote button.
  10. Mike

    Mike XenForo Developer Staff Member

    It's any option that opens up a menu.
  11. Mike

    Mike XenForo Developer Staff Member

    So @batpool52! seemed to be going down a reasonable approach: a double focus with a delay does seem to fix it. I'm totally not clear on why this happens, but I've applied a method to do this (different from the mentioned workaround).
    Optic, Chris D and batpool52! like this.

Share This Page