From e37509536abc82d79ec6580cf6e8fad7460d5436 Mon Sep 17 00:00:00 2001 From: mfo Date: Wed, 13 Dec 2023 16:14:37 +0100 Subject: [PATCH] amelioration(review): tech review Co-authored-by: Colin Darie --- .scss-lint.yml | 2 +- app/assets/stylesheets/dsfr.scss | 7 ------- app/assets/stylesheets/dsfr_override.scss | 9 +++++++++ app/components/dsfr/combobox_component.rb | 4 ---- .../dsfr/combobox_component/combobox_component.html.haml | 4 ++-- app/javascript/controllers/autosubmit_controller.ts | 1 + 6 files changed, 13 insertions(+), 14 deletions(-) create mode 100644 app/assets/stylesheets/dsfr_override.scss diff --git a/.scss-lint.yml b/.scss-lint.yml index b67166b4bec..dd6d398cfe4 100644 --- a/.scss-lint.yml +++ b/.scss-lint.yml @@ -1,7 +1,7 @@ exclude: - 'app/assets/stylesheets/reset.scss' - 'app/assets/stylesheets/direct_uploads.scss' - - 'app/assets/stylesheets/dsfr.scss' + - 'app/assets/stylesheets/dsfr_override.scss' linters: BangFormat: diff --git a/app/assets/stylesheets/dsfr.scss b/app/assets/stylesheets/dsfr.scss index 36e0eb03bbb..356eecfde02 100644 --- a/app/assets/stylesheets/dsfr.scss +++ b/app/assets/stylesheets/dsfr.scss @@ -33,13 +33,6 @@ trix-editor.fr-input { width: 100%; } } - .fr-autocomplete{ - // override dsfr chevron down which is - // --data-uri-svg: url("data:image/svg+xml;charset=utf-8,"); - // use a magnifier instead - --data-uri-svg: url("data:image/svg+xml;charset=utf-8,"); - background-image: var(--data-uri-svg); - } } @media (max-width: 62em) { diff --git a/app/assets/stylesheets/dsfr_override.scss b/app/assets/stylesheets/dsfr_override.scss new file mode 100644 index 00000000000..648426d0c47 --- /dev/null +++ b/app/assets/stylesheets/dsfr_override.scss @@ -0,0 +1,9 @@ +.fr-ds-combobox { + .fr-autocomplete{ + // override dsfr chevron down which is + // --data-uri-svg: url("data:image/svg+xml;charset=utf-8,"); + // use a magnifier instead + --data-uri-svg: url("data:image/svg+xml;charset=utf-8,"); + background-image: var(--data-uri-svg); + } +} \ No newline at end of file diff --git a/app/components/dsfr/combobox_component.rb b/app/components/dsfr/combobox_component.rb index 8a345cee538..d720875f17a 100644 --- a/app/components/dsfr/combobox_component.rb +++ b/app/components/dsfr/combobox_component.rb @@ -28,10 +28,6 @@ def html_input_options }.compact end - def hidden_html_options - @hidden_html_options || {} - end - def input_id @input_html_options[:id] end diff --git a/app/components/dsfr/combobox_component/combobox_component.html.haml b/app/components/dsfr/combobox_component/combobox_component.html.haml index a0440db911e..86dfdc7ceac 100644 --- a/app/components/dsfr/combobox_component/combobox_component.html.haml +++ b/app/components/dsfr/combobox_component/combobox_component.html.haml @@ -2,9 +2,9 @@ .fr-ds-combobox-input %input{ value: selected_option_label_input_value, **html_input_options } - if form - = form.hidden_field name, value: selected_option_value_input_value, form: form_id, **hidden_html_options + = form.hidden_field name, value: selected_option_value_input_value, form: form_id, **@hidden_html_options - else - %input{ type: 'hidden', name: name, value: selected_option_value_input_value, form: form_id, **hidden_html_options } + %input{ type: 'hidden', name: name, value: selected_option_value_input_value, form: form_id, **@hidden_html_options } .fr-menu %ul.fr-menu__list.hidden{ role: 'listbox', hidden: true, id: list_id, data: { turbo_force: :browser, options: options_json, url:, hints: hints_json }.compact } .sr-only{ aria: { live: 'polite', atomic: 'true' }, data: { turbo_force: :browser } } diff --git a/app/javascript/controllers/autosubmit_controller.ts b/app/javascript/controllers/autosubmit_controller.ts index fd037864bf2..156d54afa12 100644 --- a/app/javascript/controllers/autosubmit_controller.ts +++ b/app/javascript/controllers/autosubmit_controller.ts @@ -12,6 +12,7 @@ export class AutosubmitController extends ApplicationController { declare readonly submitterTarget: HTMLButtonElement | HTMLInputElement; declare readonly hasSubmitterTarget: boolean; declare readonly inputTarget: HTMLInputElement; + declare readonly hasInputTarget: boolean; #dateTimeChangedInputs = new WeakSet();