feat(dropdown/a11y): "other" input with label and autofocus

This commit is contained in:
Colin Darie 2023-01-24 15:14:32 +01:00
parent 4f70185a6c
commit c15ad573bc
3 changed files with 9 additions and 2 deletions

View file

@ -163,6 +163,12 @@
}
}
.drop_down_other { // scss-lint:disable SelectorFormat
label {
font-weight: normal;
}
}
input[type=text],
input[type=email],
input[type=password],

View file

@ -1,4 +1,4 @@
.drop_down_other{ class: @champ.other_value_present? ? '' : 'hidden' }
.notice
%p Veuillez saisir votre autre choix
= @form.text_field :value_other, maxlength: 200, size: nil, disabled: !@champ.other_value_present?
%label{ for: dom_id(@champ, :value_other) } Veuillez saisir votre autre choix
= @form.text_field :value_other, maxlength: 200, size: nil, id: dom_id(@champ, :value_other), disabled: !@champ.other_value_present?

View file

@ -34,6 +34,7 @@ export class ChampDropdownController extends ApplicationController {
if (target.value == '__other__') {
show(inputGroup);
input.disabled = false;
input.focus();
} else {
hide(inputGroup);
input.disabled = true;