Skip to content

Commit

Permalink
Fix settings panel layout on small screens
Browse files Browse the repository at this point in the history
Both labels and inputs protruded outside the panel on for example a
phone in portrait mode. This commit fixes that by allowing wrapping and
setting a max-width.

Since the --input-xpadding variable is now used in two different CSS
files, it was moved to constants.css.
  • Loading branch information
samhed committed Jan 22, 2025
1 parent 7870001 commit 9f135b6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
8 changes: 8 additions & 0 deletions app/styles/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,12 @@ html {
white-space: nowrap;
margin: 5px;
}
@media (max-width: 540px) {
/* Allow wrapping on small screens */
.noVNC_panel label {
white-space: unset;
}
}

.noVNC_panel li {
margin: 5px;
Expand All @@ -474,6 +480,8 @@ html {
.noVNC_panel label > textarea,
.noVNC_panel label > input:not([type=checkbox]):not([type=radio]) {
margin-left: 6px;
/* Prevent inputs in panels from being too wide */
max-width: calc(100% - var(--input-xpadding) * 2);
}

.noVNC_panel .noVNC_heading {
Expand Down
6 changes: 6 additions & 0 deletions app/styles/constants.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@
--novnc-green: rgb(0, 128, 0);
--novnc-yellow: rgb(255, 255, 0);
}

/* ------ MISC PROPERTIES ------ */

:root {
--input-xpadding: 1em;
}
4 changes: 0 additions & 4 deletions app/styles/input.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@

/* ------- SHARED BETWEEN INPUT ELEMENTS -------- */

:root {
--input-xpadding: 1em;
}

input,
textarea,
button,
Expand Down

0 comments on commit 9f135b6

Please sign in to comment.