From 3655a74b9488000722fa298727e78412e24ca714 Mon Sep 17 00:00:00 2001 From: cryptogopher Date: Thu, 5 Nov 2026 18:00:34 +0100 Subject: [PATCH] Prevent table columns' width change on form toggle --- app/assets/images/check-outline.svg | 1 + app/assets/images/plus-circle-outline.svg | 1 - app/assets/stylesheets/application.css | 42 +++++++++++++++------- app/helpers/application_helper.rb | 5 +-- app/javascript/application.js | 2 +- app/models/quantity.rb | 2 ++ app/views/measurements/_form.html.erb | 2 +- app/views/quantities/_form.html.erb | 18 +++++----- app/views/quantities/_form_close.html.erb | 2 +- app/views/quantities/_quantity.html.erb | 4 +-- app/views/quantities/edit.turbo_stream.erb | 15 ++++---- app/views/quantities/index.html.erb | 11 ++++-- app/views/quantities/new.turbo_stream.erb | 15 ++++---- app/views/units/_form.html.erb | 18 +++++----- app/views/units/_form_close.html.erb | 2 +- app/views/units/_unit.html.erb | 4 +-- app/views/units/edit.turbo_stream.erb | 15 ++++---- app/views/units/index.html.erb | 16 ++++++--- app/views/units/new.turbo_stream.erb | 16 +++++---- app/views/units/rebase.turbo_stream.erb | 1 + config/locales/en.yml | 5 ++- test/application_system_test_case.rb | 21 +++++++---- test/system/units_test.rb | 22 +++++++++--- 23 files changed, 150 insertions(+), 90 deletions(-) create mode 100644 app/assets/images/check-outline.svg delete mode 100644 app/assets/images/plus-circle-outline.svg diff --git a/app/assets/images/check-outline.svg b/app/assets/images/check-outline.svg new file mode 100644 index 0000000..5833269 --- /dev/null +++ b/app/assets/images/check-outline.svg @@ -0,0 +1 @@ + diff --git a/app/assets/images/plus-circle-outline.svg b/app/assets/images/plus-circle-outline.svg deleted file mode 100644 index a4dcfdd..0000000 --- a/app/assets/images/plus-circle-outline.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 28c606b..a2010be 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -72,10 +72,20 @@ fill: var(--color-border-gray) !important; pointer-events: none !important; } -/* Styles set `display` without distinguishing between [hidden] elements, making - * them visible. */ +/* For hidden elements that need to influence layout and/or are only temporarily + * hidden use [hidden=until-found] instead of [hidden] to: + * - avoid hiding with `display: none` as `display` may be overridden by + * selectors with greater specificity and element may become visible, + * - use `visibility: collapse` for hiding, to avoid excessive resizing. + * TODO: change to `until-found` after upgrade to Rails > 8.1.4 (#59338) + * - change hidden values in index s + * - check if toggleAttribute("hidden") works properly (use turbo action #hide?) +[hidden=until-found] { + visibility: collapse; +}*/ [hidden] { - display: none !important; + display: revert; + visibility: collapse; } @@ -229,6 +239,7 @@ pre { display: flex; fill: var(--color-gray); font-weight: bold; + justify-content: center; } .button { border: 1px solid var(--color-gray); @@ -252,6 +263,7 @@ table .button { font-weight: normal; height: 100%; padding: 0.4em; + width: 100%; } .button:focus-visible, .tab:focus-visible, @@ -460,25 +472,26 @@ header { .tabular-form table td:last-child { padding-inline-end: 0; } -.tabular-form table :is(form, input, select, textarea):only-child { - margin-inline-start: 0; +.tabular-form table :is(input, select, textarea) { + margin-inline: 0; } +/* FIXME: