feat(dropdown/a11y): "other" input with label and autofocus
This commit is contained in:
parent
4f70185a6c
commit
c15ad573bc
3 changed files with 9 additions and 2 deletions
|
@ -163,6 +163,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
.drop_down_other { // scss-lint:disable SelectorFormat
|
||||
label {
|
||||
font-weight: normal;
|
||||
}
|
||||
}
|
||||
|
||||
input[type=text],
|
||||
input[type=email],
|
||||
input[type=password],
|
||||
|
|
|
@ -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?
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue