From 20e451f211903446b7e534f69f5e2986df7f468a Mon Sep 17 00:00:00 2001 From: Aleksander Nowodzinski Date: Fri, 21 Apr 2017 16:49:19 +0200 Subject: [PATCH] Fix: Esc should close the link panel even if none of the fields is focused. Closes #90. --- src/ui/linkformview.js | 5 ++++- tests/ui/linkformview.js | 1 + theme/components/linkform.scss | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ui/linkformview.js b/src/ui/linkformview.js index 3d931be..9db9ae3 100644 --- a/src/ui/linkformview.js +++ b/src/ui/linkformview.js @@ -124,7 +124,10 @@ export default class LinkFormView extends View { attributes: { class: [ 'ck-link-form', - ] + ], + + // https://github.com/ckeditor/ckeditor5-link/issues/90 + tabindex: '-1' }, children: [ diff --git a/tests/ui/linkformview.js b/tests/ui/linkformview.js index c4f9e2e..f9c6f75 100644 --- a/tests/ui/linkformview.js +++ b/tests/ui/linkformview.js @@ -26,6 +26,7 @@ describe( 'LinkFormView', () => { describe( 'constructor()', () => { it( 'should create element from template', () => { expect( view.element.classList.contains( 'ck-link-form' ) ).to.true; + expect( view.element.getAttribute( 'tabindex' ) ).to.equal( '-1' ); } ); it( 'should create child views', () => { diff --git a/theme/components/linkform.scss b/theme/components/linkform.scss index f712516..d93f90e 100644 --- a/theme/components/linkform.scss +++ b/theme/components/linkform.scss @@ -8,6 +8,11 @@ padding: ck-spacing( 'large' ); overflow: hidden; + &:focus { + // https://github.com/ckeditor/ckeditor5-link/issues/90 + outline: none; + } + .ck-label { margin-bottom: ck-spacing( 'small' ); }