mirror of
https://github.com/Microsoft/vscode
synced 2024-10-30 06:38:23 +00:00
adds limit on issue reporter description (#208346)
This commit is contained in:
parent
774f610801
commit
adfa191fec
2 changed files with 13 additions and 1 deletions
|
@ -83,6 +83,7 @@ export default (): string => `
|
||||||
<textarea name="description" id="description" placeholder="${escape(localize('details', "Please enter details."))}" required></textarea>
|
<textarea name="description" id="description" placeholder="${escape(localize('details', "Please enter details."))}" required></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div id="description-empty-error" class="validation-error hidden" role="alert">${escape(localize('descriptionEmptyValidation', "A description is required."))}</div>
|
<div id="description-empty-error" class="validation-error hidden" role="alert">${escape(localize('descriptionEmptyValidation', "A description is required."))}</div>
|
||||||
|
<div id="description-short-error" class="validation-error hidden" role="alert">${escape(localize('descriptionTooShortValidation', "Please provide a longer description."))}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="system-info" id="block-container">
|
<div class="system-info" id="block-container">
|
||||||
|
|
|
@ -924,13 +924,24 @@ export class IssueReporter extends Disposable {
|
||||||
private validateInput(inputId: string): boolean {
|
private validateInput(inputId: string): boolean {
|
||||||
const inputElement = (<HTMLInputElement>this.getElementById(inputId));
|
const inputElement = (<HTMLInputElement>this.getElementById(inputId));
|
||||||
const inputValidationMessage = this.getElementById(`${inputId}-empty-error`);
|
const inputValidationMessage = this.getElementById(`${inputId}-empty-error`);
|
||||||
|
const descriptionShortMessage = this.getElementById(`description-short-error`);
|
||||||
if (!inputElement.value) {
|
if (!inputElement.value) {
|
||||||
inputElement.classList.add('invalid-input');
|
inputElement.classList.add('invalid-input');
|
||||||
inputValidationMessage?.classList.remove('hidden');
|
inputValidationMessage?.classList.remove('hidden');
|
||||||
|
descriptionShortMessage?.classList.add('hidden');
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else if (inputId === 'description' && inputElement.value.length < 10) {
|
||||||
|
inputElement.classList.add('invalid-input');
|
||||||
|
descriptionShortMessage?.classList.remove('hidden');
|
||||||
|
inputValidationMessage?.classList.add('hidden');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
inputElement.classList.remove('invalid-input');
|
inputElement.classList.remove('invalid-input');
|
||||||
inputValidationMessage?.classList.add('hidden');
|
inputValidationMessage?.classList.add('hidden');
|
||||||
|
if (inputId === 'description') {
|
||||||
|
descriptionShortMessage?.classList.add('hidden');
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue