Sfoglia il codice sorgente

Fix: Esc key should close the link panel even if none of the `LinkFormView` fields is focused. Closes #90.

t/90: Esc key should close the link panel even if none of the form fields is focused
Oskar Wróbel 8 anni fa
parent
commit
61048cadbf

+ 4 - 1
packages/ckeditor5-link/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: [

+ 1 - 0
packages/ckeditor5-link/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', () => {

+ 5 - 0
packages/ckeditor5-link/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' );
 		}