From 33004f62bd45457a43d121ad4ab219155ca9f5f3 Mon Sep 17 00:00:00 2001 From: cryptogopher Date: Sun, 22 Mar 2026 01:06:38 +0100 Subject: [PATCH] Improve Measurement form layout and styling --- app/assets/stylesheets/application.css | 187 +++++++++++++------------ app/helpers/application_helper.rb | 3 +- app/helpers/quantities_helper.rb | 4 +- app/views/default/units/index.html.erb | 2 +- app/views/measurements/_form.html.erb | 49 ++++--- app/views/quantities/index.html.erb | 3 +- app/views/readouts/_form.html.erb | 15 +- app/views/units/index.html.erb | 3 +- app/views/users/index.html.erb | 2 +- config/locales/en.yml | 6 +- 10 files changed, 150 insertions(+), 124 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 97ceb44..f6404da 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -58,16 +58,18 @@ outline: none; } /* NOTE: move to higher priority layer instead of using !important? */ +/* TODO: add CSS @layer requirements in README */ [disabled] { border-color: var(--color-border-gray) !important; color: var(--color-border-gray) !important; - /* NOTE: cannot set cursor with `pointer-events: none`; can be fixed by setting + /* NOTE: cannot set cursor when `pointer-events: none`; can be fixed by setting * `cursor` on wrapping element. cursor: not-allowed; */ fill: var(--color-border-gray) !important; pointer-events: none !important; } -/* [hidden] submit elements cannot have `display` set as it makes them visible. */ +/* Styles set `display` without distinguishing between [hidden] elements, making + * them visible. */ [hidden] { display: none !important; } @@ -122,6 +124,7 @@ input[type=checkbox]:checked { input[type=number] { appearance: textfield; -moz-appearance: textfield; + text-align: end; } input::-webkit-inner-spin-button { -webkit-appearance: none; @@ -130,6 +133,26 @@ input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; } +/* Text color of table form controls: + * - black for row/table forms, + * - inherited for internal (column specific) buttons/forms. */ +table input, +table select, +table summary, +table textarea { + border-color: var(--color-border-gray); +} +table input, +table select, +table textarea { + padding-block: 0.375em; +} +table form input, +table form select, +table form summary, +table form textarea { + color: inherit; +} input:focus-visible, select:focus-visible, select:focus-within, @@ -138,6 +161,7 @@ summary:focus-visible, textarea:focus-visible { accent-color: var(--color-dark-blue); background-color: var(--color-focus-gray); + color: black; } input:hover, select:hover, @@ -148,8 +172,15 @@ textarea:hover { } select:hover, summary:hover { + color: black; cursor: pointer; } +/* TODO: style
/ focus to match