Fix input validation alert (#15749)

* Fix input validation alert

* Add override
This commit is contained in:
Charles Gagnon
2021-06-17 13:47:53 -07:00
committed by GitHub
parent d871efc079
commit 331f8115dc
2 changed files with 32 additions and 7 deletions

View File

@@ -11,10 +11,10 @@ import {
import * as azdata from 'azdata';
import { ComponentBase } from 'sql/workbench/browser/modelComponents/componentBase';
import { InputBox } from 'sql/base/browser/ui/inputBox/inputBox';
import { IInputOptions, InputBox } from 'sql/base/browser/ui/inputBox/inputBox';
import { attachInputBoxStyler } from 'sql/platform/theme/common/styler';
import { IInputOptions, MessageType } from 'vs/base/browser/ui/inputbox/inputBox';
import { MessageType } from 'vs/base/browser/ui/inputbox/inputBox';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import * as nls from 'vs/nls';
@@ -73,6 +73,7 @@ export default class InputBoxComponent extends ComponentBase<azdata.InputBoxProp
useDefaultValidation: true
};
if (this._inputContainer) {
inputOptions.requireForceValidations = true; // Non-text area input boxes handle our own validations when the text changes so don't run the base ones
this._input = new InputBox(this._inputContainer.nativeElement, this.contextViewService, inputOptions);
this.onkeydown(this._input.inputElement, (e: StandardKeyboardEvent) => {
if (e.keyCode === KeyCode.Enter) {
@@ -159,7 +160,7 @@ export default class InputBoxComponent extends ComponentBase<azdata.InputBoxProp
public override async validate(): Promise<boolean> {
await super.validate();
// Let the input validate handle showing/hiding the error message
const valid = this.inputElement.validate() === undefined;
const valid = this.inputElement.validate(true) === undefined;
// set aria label based on validity of input
if (valid) {