Skip to content
Snippets Groups Projects
Commit 7c28e6c7 authored by Andreas Fernandez's avatar Andreas Fernandez Committed by Markus Klein
Browse files

[BUGFIX] Only focus RTE if current focus is on body tag

Focus the RTE (or its textarea fallback) only if the current focus
is on the body tag, which is the default after loading a page.
This prevents focus stealing if the focus is e.g. on an input field
before the RTE was initialized.

Resolves: #72900
Releases: master, 7.6
Change-Id: I238cd0ce1972f41e451ace674eeff350690cb427
Reviewed-on: https://review.typo3.org/47528


Reviewed-by: default avatarFrank Naegler <frank.naegler@typo3.org>
Tested-by: default avatarFrank Naegler <frank.naegler@typo3.org>
Reviewed-by: default avatarMarkus Klein <markus.klein@typo3.org>
Tested-by: default avatarMarkus Klein <markus.klein@typo3.org>
parent 8f601d53
Branches
Tags
No related merge requests found
......@@ -506,6 +506,11 @@ define(['TYPO3/CMS/Rtehtmlarea/HTMLArea/UserAgent/UserAgent',
* Focus on the editor
*/
Editor.prototype.focus = function () {
if (document.activeElement.tagName.toLowerCase() !== 'body') {
// Only focus the editor if the body tag is focused, which is
// the default after loading a page
return;
}
switch (this.getMode()) {
case 'wysiwyg':
this.iframe.focus();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment