Skip to content

Commit

Permalink
Disable call-to-action button when hostname is empty (#1538)
Browse files Browse the repository at this point in the history
I noticed a tiny UI glitch, where we are inconsistent with our style
guide: [call-to-action buttons should be disabled, if the corresponding
input field is
empty](https://github.com/tiny-pilot/tinypilot/blob/1354e914f364c5e1de5d922ea0a68fc7e976f3df/app/templates/styleguide.html#L168-L171).
This PR fixes this issue for the hostname dialog.


https://github.com/tiny-pilot/tinypilot/assets/83721279/a06eeeea-5bb2-45f5-8f48-9ac2aa639ff9


<a data-ca-tag
href="https://codeapprove.com/pr/tiny-pilot/tinypilot/1538"><img
src="https://codeapprove.com/external/github-tag-allbg.png" alt="Review
on CodeApprove" /></a>
  • Loading branch information
jotaen4tinypilot authored Jul 27, 2023
1 parent 0e40e22 commit 0ef51ca
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/templates/custom-elements/change-hostname-dialog.html
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,9 @@ <h3>Changing Hostname</h3>
_onInputChanged() {
const isEqualToInitialValue =
this.elements.hostnameInput.value === this.initialHostname;
this.elements.changeAndRestart.disabled = isEqualToInitialValue;
const isEmpty = this.elements.hostnameInput.value === "";
this.elements.changeAndRestart.disabled =
isEmpty || isEqualToInitialValue;
}

_doChangeHostname() {
Expand Down

0 comments on commit 0ef51ca

Please sign in to comment.