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.