File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
src/ui.form-input-counter Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -154,6 +154,24 @@ function onInput() {
154154 setInputSize ();
155155}
156156
157+ function onKeyDown(event : KeyboardEvent ) {
158+ if (event .key === " ArrowUp" ) {
159+ event .preventDefault ();
160+
161+ if (! isAddButtonDisabled .value && ! props .disabled ) {
162+ onClickAdd ();
163+ }
164+ }
165+
166+ if (event .key === " ArrowDown" ) {
167+ event .preventDefault ();
168+
169+ if (! isSubtractButtonDisabled .value && ! props .disabled ) {
170+ onClickSubtract ();
171+ }
172+ }
173+ }
174+
157175function setInputSize() {
158176 if (inputComponentRef .value && ! props .readonly ) {
159177 inputComponentRef .value .inputRef ?.setAttribute (
@@ -222,6 +240,7 @@ const {
222240 @focus =" onFocus"
223241 @blur =" onBlur"
224242 @input =" onInput"
243+ @keydown =" onKeyDown"
225244 />
226245
227246 <UButton
You can’t perform that action at this time.
0 commit comments