Skip to content

Commit

Permalink
ui/ux: styling input validation (#12585)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladarama authored Jun 29, 2023
1 parent dc7d9f3 commit d2f091a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
3 changes: 2 additions & 1 deletion examples/playwright/src/theia-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export class TheiaDialog extends TheiaPageObject {
protected titleSelector = this.titleBarSelector + ' > div';
protected contentSelector = this.blockSelector + ' .dialogContent > div';
protected controlSelector = this.blockSelector + ' .dialogControl';
protected errorSelector = this.blockSelector + ' .dialogContent';

async waitForVisible(): Promise<void> {
await this.page.waitForSelector(`${this.blockSelector}`, { state: 'visible' });
Expand Down Expand Up @@ -64,7 +65,7 @@ export class TheiaDialog extends TheiaPageObject {
}

protected async validationElement(): Promise<ElementHandle<SVGElement | HTMLElement>> {
return this.page.waitForSelector(`${this.controlSelector} div.error`);
return this.page.waitForSelector(`${this.errorSelector} div.error`, { state: 'attached' });
}

async getValidationText(): Promise<string | null> {
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/browser/dialogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,10 @@ export class SingleTextInputDialog extends AbstractDialog<string> {
} else {
this.inputField.select();
}

this.contentNode.appendChild(this.inputField);
this.controlPanel.removeChild(this.errorMessageNode);
this.contentNode.appendChild(this.errorMessageNode);

this.appendAcceptButton(props.confirmButtonLabel);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/keymaps/src/browser/keybindings-widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ export class KeybindingWidget extends ReactWidget implements StatefulWidget {
const binding = { command, keybinding };
KeySequence.parse(keybinding);
if (oldKeybinding === keybinding) {
return ' '; // if old and new keybindings match, quietly reject update
return ''; // if old and new keybindings match, quietly reject update
}
if (this.keybindingRegistry.containsKeybindingInScope(binding)) {
return nls.localize('theia/keymaps/keybindingCollidesValidation', 'keybinding currently collides');
Expand Down
10 changes: 4 additions & 6 deletions packages/preferences/src/browser/style/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@

.theia-settings-container .theia-input[type="checkbox"]:focus,
.theia-settings-container .theia-input[type="number"]:focus {
outline-width: 2px;
outline-width: 1px;
}

.theia-settings-container .theia-input[type="checkbox"] {
Expand All @@ -404,12 +404,10 @@
margin: 0;
}

.theia-settings-container
.pref-content-container
.pref-input
.pref-input-container
.pref-error-notification {
.dialogContent .error:not(:empty),
.theia-settings-container .pref-content-container .pref-input .pref-input-container .pref-error-notification {
border-style: solid;
border-width: 1px;
border-color: var(--theia-inputValidation-errorBorder);
background-color: var(--theia-inputValidation-errorBackground);
width: 100%;
Expand Down

0 comments on commit d2f091a

Please sign in to comment.