From 2ed4b3153f25ba982594cbf27ee7d966076e78cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Zag=C3=B3rski?= Date: Mon, 13 Sep 2021 13:56:50 +0200 Subject: [PATCH] Fixed focus after escaping dropdown. --- packages/ckeditor5-find-and-replace/src/findandreplaceui.js | 4 ++-- packages/ckeditor5-find-and-replace/tests/findandreplaceui.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/ckeditor5-find-and-replace/src/findandreplaceui.js b/packages/ckeditor5-find-and-replace/src/findandreplaceui.js index bdd43639ce2..1d9bbe85b8b 100644 --- a/packages/ckeditor5-find-and-replace/src/findandreplaceui.js +++ b/packages/ckeditor5-find-and-replace/src/findandreplaceui.js @@ -60,7 +60,7 @@ export default class FindAndReplaceUI extends Plugin { // the default action of the drop-down is executed (i.e. the panel showed up). Otherwise, // the invisible form/input cannot be focused/selected. // - // Each time a dropdown is closed, move the focus back to the editing root (to preserve it) + // Each time a dropdown is closed, move the focus back to the find and replace toolbar button // and let the find and replace editing feature know that all search results can be invalidated // and no longer should be marked in the content. dropdown.on( 'change:isOpen', ( event, name, isOpen ) => { @@ -73,7 +73,7 @@ export default class FindAndReplaceUI extends Plugin { formView.enableCssTransitions(); } else { - editor.editing.view.focus(); + formView.focus(); this.fire( 'searchReseted' ); } diff --git a/packages/ckeditor5-find-and-replace/tests/findandreplaceui.js b/packages/ckeditor5-find-and-replace/tests/findandreplaceui.js index 8e09ea8917f..8966ca86b2f 100644 --- a/packages/ckeditor5-find-and-replace/tests/findandreplaceui.js +++ b/packages/ckeditor5-find-and-replace/tests/findandreplaceui.js @@ -122,10 +122,10 @@ describe( 'FindAndReplaceUI', () => { } ); describe( 'upon dropdown close', () => { - it( 'the editing view should be focused', () => { + it( 'the form should be focused', () => { dropdown.isOpen = true; - const spy = sinon.spy( editor.editing.view, 'focus' ); + const spy = sinon.spy( form, 'focus' ); dropdown.isOpen = false;