瀏覽代碼

Enhanced the UX of the labeled input view by removing errors as ther user starts typing.

Aleksander Nowodzinski 7 年之前
父節點
當前提交
6456c711d6

+ 4 - 0
packages/ckeditor5-ui/src/inputtext/inputtextview.js

@@ -78,6 +78,10 @@ export default class InputTextView extends View {
 				id: bind.to( 'id' ),
 				placeholder: bind.to( 'placeholder' ),
 				readonly: bind.to( 'isReadOnly' )
+			},
+			on: {
+				keydown: bind.to( 'keydown' ),
+				change: bind.to( 'change' )
 			}
 		} );
 	}

+ 5 - 0
packages/ckeditor5-ui/src/labeledinput/labeledinputview.js

@@ -139,6 +139,11 @@ export default class LabeledInputView extends View {
 		inputView.bind( 'value' ).to( this );
 		inputView.bind( 'isReadOnly' ).to( this );
 		inputView.bind( 'hasError' ).to( this, 'errorText', value => !!value );
+		inputView.on( 'keydown', () => {
+			// UX: Make the error text disappear and disable the error indicator as the user
+			// starts fixing the errors.
+			this.errorText = false;
+		} );
 
 		return inputView;
 	}