소스 검색

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

Aleksander Nowodzinski 7 년 전
부모
커밋
6456c711d6
2개의 변경된 파일9개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      packages/ckeditor5-ui/src/inputtext/inputtextview.js
  2. 5 0
      packages/ckeditor5-ui/src/labeledinput/labeledinputview.js

+ 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;
 	}