From 98364c3daa554a2d7de600263b18898aeee3d39b Mon Sep 17 00:00:00 2001 From: Samuel Mannehed Date: Tue, 13 Dec 2022 14:43:03 +0100 Subject: [PATCH 1/7] Use the same background gradient on all buttons Before, we have had two different gradiant versions, one where the two colors meet in the middle, and one where only the top part of the element was the darker shade. This was easily missed. Let's standardize on the latter alternative. This commit introduces a variable to make it easier. --- app/styles/input.css | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/styles/input.css b/app/styles/input.css index d746b764..75fc2108 100644 --- a/app/styles/input.css +++ b/app/styles/input.css @@ -20,7 +20,8 @@ input, input::file-selector-button, button, select, textarea { border: 1px solid rgb(192, 192, 192); border-radius: 5px; color: black; - background-image: linear-gradient(to top, rgb(255, 255, 255) 80%, rgb(240, 240, 240)); + --bg-gradient: linear-gradient(to top, rgb(255, 255, 255) 80%, rgb(240, 240, 240)); + background-image: var(--bg-gradient); } /* @@ -54,8 +55,7 @@ select { stroke="rgb(31,31,31)" fill="none" \ stroke-linecap="round" stroke-linejoin="round" /> \ '); - background-image: var(--select-arrow), - linear-gradient(to top, rgb(255, 255, 255), rgb(240, 240, 240)); + background-image: var(--select-arrow), var(--bg-gradient); background-position: calc(100% - 7px), left top; background-repeat: no-repeat; padding-right: calc(2*7px + 8px); @@ -244,7 +244,7 @@ textarea:disabled { :root:not(.noVNC_touch) input:disabled::file-selector-button, :root:not(.noVNC_touch) button:disabled, :root:not(.noVNC_touch) select:disabled { - background-image: linear-gradient(to top, rgb(255, 255, 255), rgb(240, 240, 240)); + background-image: var(--bg-gradient); border-bottom-width: 2px; margin-top: 0; } @@ -252,8 +252,7 @@ input[type=file]:disabled { background-image: none; } :root:not(.noVNC_touch) select:disabled { - background-image: var(--select-arrow), - linear-gradient(to top, rgb(255, 255, 255), rgb(240, 240, 240)); + background-image: var(--select-arrow), var(--bg-gradient); } input[type=image]:disabled { /* See Firefox bug: From 6e1eec3025517523294a601930de14d39e3fb349 Mon Sep 17 00:00:00 2001 From: Samuel Mannehed Date: Tue, 13 Dec 2022 14:54:41 +0100 Subject: [PATCH 2/7] Separate the disabling of :hover for touch This is a corner case which shouldn't need to complicate things for the regular usecases. --- app/styles/base.css | 18 ++++++++++++++---- app/styles/input.css | 29 +++++++++++++++++++++-------- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/app/styles/base.css b/app/styles/base.css index 408da277..54e197f1 100644 --- a/app/styles/base.css +++ b/app/styles/base.css @@ -389,19 +389,18 @@ html { vertical-align: middle; border:1px solid rgba(255, 255, 255, 0.2); border-radius: 6px; + background-color: transparent; background-image: unset; /* we don't want the gradiant from input.css */ } #noVNC_control_bar .noVNC_button.noVNC_selected { border-color: rgba(0, 0, 0, 0.8); background-color: rgba(0, 0, 0, 0.5); } -/* Android browsers don't properly update hover state if touch events are - * intercepted, like they are when clicking on the remote screen. */ -:root:not(.noVNC_touch) #noVNC_control_bar .noVNC_button.noVNC_selected:not(:disabled):hover { +#noVNC_control_bar .noVNC_button.noVNC_selected:not(:disabled):hover { border-color: rgba(0, 0, 0, 0.4); background-color: rgba(0, 0, 0, 0.2); } -:root:not(.noVNC_touch) #noVNC_control_bar .noVNC_button:not(:disabled):hover { +#noVNC_control_bar .noVNC_button:not(:disabled):hover { background-color: rgba(255, 255, 255, 0.2); } #noVNC_control_bar .noVNC_button:not(:disabled):active { @@ -412,6 +411,17 @@ html { display: none !important; } +/* Android browsers don't properly update hover state if touch events are + * intercepted, like they are when clicking on the remote screen. */ +:root.noVNC_touch #noVNC_control_bar .noVNC_button:not(:disabled):hover { + background-color: transparent; +} +:root.noVNC_touch #noVNC_control_bar .noVNC_button.noVNC_selected:not(:disabled):hover { + border-color: rgba(0, 0, 0, 0.8); + background-color: rgba(0, 0, 0, 0.5); +} + + /* Panels */ .noVNC_panel { transform: translateX(25px); diff --git a/app/styles/input.css b/app/styles/input.css index 75fc2108..b6ffd6d1 100644 --- a/app/styles/input.css +++ b/app/styles/input.css @@ -180,21 +180,34 @@ input::file-selector-button { /* * Hover */ -:root:not(.noVNC_touch) input[type=button]:hover, -:root:not(.noVNC_touch) input[type=color]:hover, -:root:not(.noVNC_touch) input[type=image]:hover, -:root:not(.noVNC_touch) input[type=reset]:hover, -:root:not(.noVNC_touch) input[type=submit]:hover, -:root:not(.noVNC_touch) input::file-selector-button:hover, -:root:not(.noVNC_touch) button:hover { +input[type=button]:hover, +input[type=color]:hover, +input[type=image]:hover, +input[type=reset]:hover, +input[type=submit]:hover, +input::file-selector-button:hover, +button:hover { background-image: linear-gradient(to top, rgb(255, 255, 255), rgb(250, 250, 250)); } -:root:not(.noVNC_touch) select:hover { +select:hover { background-image: var(--select-arrow), linear-gradient(to top, rgb(255, 255, 255), rgb(250, 250, 250)); background-position: calc(100% - 7px), left top; background-repeat: no-repeat; } +/* We don't want a hover style after touch input */ +:root.noVNC_touch input[type=button]:hover, +:root.noVNC_touch input[type=color]:hover, +:root.noVNC_touch input[type=image]:hover, +:root.noVNC_touch input[type=reset]:hover, +:root.noVNC_touch input[type=submit]:hover, +:root.noVNC_touch input::file-selector-button:hover, +:root.noVNC_touch button:hover { + background-image: var(--bg-gradient); +} +:root.noVNC_touch select:hover { + background-image: var(--select-arrow), var(--bg-gradient); +} /* * Active (clicked) From 333e075d7b4d92a3a9a4e2c3be08b165294b8af5 Mon Sep 17 00:00:00 2001 From: Samuel Mannehed Date: Tue, 13 Dec 2022 15:38:25 +0100 Subject: [PATCH 3/7] Get rid of Chrome's blue touch tap highlight When tapping our buttons using a touch screen in Chrome, we get an ugly blue overlay. Let's remove this since we have our own :active styles. --- app/styles/input.css | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/styles/input.css b/app/styles/input.css index b6ffd6d1..6d39bd7c 100644 --- a/app/styles/input.css +++ b/app/styles/input.css @@ -42,6 +42,9 @@ select { padding-left: 20px; padding-right: 20px; + + /* Disable Chrome's touch tap highlight */ + -webkit-tap-highlight-color: transparent; } /* From 1ff035c330e8aa1dfe5d1a6e7f9aebf5e3c80428 Mon Sep 17 00:00:00 2001 From: Samuel Mannehed Date: Wed, 14 Dec 2022 11:18:46 +0100 Subject: [PATCH 4/7] Add comment explaining the handle touch area --- app/styles/base.css | 1 + 1 file changed, 1 insertion(+) diff --git a/app/styles/base.css b/app/styles/base.css index 54e197f1..402454cb 100644 --- a/app/styles/base.css +++ b/app/styles/base.css @@ -321,6 +321,7 @@ html { .noVNC_right #noVNC_control_bar.noVNC_open #noVNC_control_bar_handle:after { transform: none; } +/* Larger touch area for the handle, used when a touch screen is available */ #noVNC_control_bar_handle div { position: absolute; right: -35px; From f983c78d173322c080c7a8805fc8da436dc4e4d0 Mon Sep 17 00:00:00 2001 From: Samuel Mannehed Date: Wed, 14 Dec 2022 13:28:27 +0100 Subject: [PATCH 5/7] Make connect button a regular From 6d7d45ba08e203e616171e53cea5b2bd2314dc4d Mon Sep 17 00:00:00 2001 From: Samuel Mannehed Date: Wed, 14 Dec 2022 13:58:49 +0100 Subject: [PATCH 6/7] Ensure arrow doesn't change on disabled