Fixed  BB editor - Inserting URL breaks if form has no selected text


Active member
To reproduce it try pasting a link before the "Insert Link" modal window fully loads in browser. If you do it right you will have pasted the link to the form behind the modal window and get the text you had selected, unselected. After the modal loads, type a url and hit insert. Modal now redirects to the home like an iframe.

In the case the form is unchanged but the text got unselected (either via tab+arrows or by the above way), proceed the action to the selection that was originally selected (save the selected text position on the modal init start).
In case it's detected that the form has changed, notify the user and close the modal window.

All modals suffer from the same issue., I think that any modal window in XenForo must not allow ANY changes to the "inactive" parent page. Disable tab to disallow modals get blurred or better check on every page event that the modal or its children are focused.
In user interface design, a modal window is a child window that requires users to interact with it before they can return to operating the parent application, thus preventing the workflow on the application main window. Modal windows are often called heavy windows or modal dialogs because the window is often used to display a dialog box.
My 2¢


XenForo developer
Staff member
Ironic that this bug was reported, but the specific elements about typing didn't come up. Regardless, I have already mitigated the effects of the bug. I was now able to prevent the JS error. I also added a change that seems to work in everything but Opera that prevents you from typing while the dialog is loading (but doesn't wipe out the editor selection).