Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing focus after escaping find and replace dropdown #10523

Merged
merged 1 commit into from
Sep 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/ckeditor5-find-and-replace/src/findandreplaceui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) => {
Expand All @@ -73,7 +73,7 @@ export default class FindAndReplaceUI extends Plugin {

formView.enableCssTransitions();
} else {
editor.editing.view.focus();
formView.focus();

this.fire( 'searchReseted' );
}
Expand Down
4 changes: 2 additions & 2 deletions packages/ckeditor5-find-and-replace/tests/findandreplaceui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down