Problem/Motivation
Address @todo comment on line 121 of ckeditor5.module:
// @todo if this triggers the callback via keyboard navigation such as
// tab, focus should move to the next element, not to the rebuilt
// "allowed tags" field.
Which should include addressing issues where focus is assigned to an about-to-be-rebuilt form element. When tab navigating, tabbing away from an changed element that results in a form rebuild may move focus to an element that is part of that rebuild. If the focused element is rebuilt by AJAX, it essentially vanishes and focus does not no where to go. The browser has no way of automatically distinguishing the "replacement" element from some other random element added to the page.
Steps to reproduce
- Enable CKE 5
- Enable source editor
- Add new element to the source editor editable tags, for example
<script>
- Use shift tab to navigate away from the textarea
The element focused is <body>
instead of the previous focusable element of the form, which is next vertical-tab tab (Language for me).