From fbe52117edc7f16fec9c4ffce797f1e591eeded5 Mon Sep 17 00:00:00 2001 From: Thomas Rupprecht Date: Mon, 5 Dec 2022 02:04:05 +0100 Subject: [PATCH] improve spinner control use input type `number` with `min` and `step` use `.stepDown()` and `.stepUp()` to change value hide browser controls --- includes/sys_form.php | 19 +++++++++---------- resources/assets/themes/base.scss | 11 +++++++++++ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/includes/sys_form.php b/includes/sys_form.php index b8d82708..c7597d28 100644 --- a/includes/sys_form.php +++ b/includes/sys_form.php @@ -25,29 +25,28 @@ function form_hidden($name, $value) */ function form_spinner($name, $label, $value) { + $id = 'spinner-' . $name; $value = htmlspecialchars((string)$value); return form_element($label, '
- - -
- ', 'spinner-' . $name); + ', $id); } /** diff --git a/resources/assets/themes/base.scss b/resources/assets/themes/base.scss index ca1466bc..d82d03a2 100644 --- a/resources/assets/themes/base.scss +++ b/resources/assets/themes/base.scss @@ -372,3 +372,14 @@ code { max-width: 75%; display: inline-block; } + +/* Chrome, Safari, Edge, Opera */ +input[type=number]::-webkit-outer-spin-button, +input[type=number]::-webkit-inner-spin-button { + -webkit-appearance: none; + margin: 0; +} +/* Firefox */ +input[type=number] { + -moz-appearance: textfield; +}