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

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:
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.
 
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.
 
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.
 
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-
Find:
Code:
ed.$editor.on('focus click', function(e) {
                if (blurTimeout)
                {
                    clearTimeout(blurTimeout);
                    blurTimeout = null;
                }
                ed.$box.addClass('focused');
            });
Add after:
Code:
ed.$editor.on('focus', function(e)
            {
                if ($.browser.webkit) // zanpakuto is Webkit...
                {
                    window.setTimeout(function()
                    {
                        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:
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).

focus-issue.gif

So it seems the cursor position is in the right spot even after losing focus.
 
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.
 
Top Bottom