- Issue created by @tom konda
The ckeditor5.admin.js recieves keyCode value from a KeyboardEvent for Safari focus problem. In fact, web browsers such as Chrome and Safari and so on send keyCode value on a KeyboardEvent and work this JavaScript code when a "ArrowUp" is pressed.
But CKEditor5TestBase->triggerKeyUp()
method which is used some of CKEditor5 FunctionalJavaScript tests, sends only key value on a KeyboardEvent()
. Therefore, JavaScript code which fix Safari focus problem doesn't work on a FunctionalJavaScript test.
Change code as follows and run FunctionalJavaScript test.
/core/modules/ckeditor5/js/ckeditor5.admin.js
once('safari-focus-fix', '.ckeditor5-toolbar-item').forEach((item) => {
item.addEventListener('keydown', (e) => {
// Add two below lines.
drupalSettings.keyTest = drupalSettings.keyTest ?? [];
drupalSettings.keyTest.push(e.keyCode);
// Add two above lines.
const keyCodeDirections = {
9: 'tab',
37: 'left',
38: 'up',
39: 'right',
40: 'down',
};
/core/modules/ckeditor5/tests/src/FunctionalJavascript/SourceEditingTest.php
$this->assertNotEmpty($assert_session->waitForElement('css', '.ckeditor5-toolbar-item-sourceEditing'));
$this->triggerKeyUp('.ckeditor5-toolbar-item-sourceEditing', 'ArrowDown');
// Add a below line.
print_r($this->getDrupalSettings()['keyTest']);
// Add a above line.
$assert_session->assertWaitOnAjaxRequest();
Active
11.0 🔥
ckeditor5.module