[FIX] web_widget_numeric_step: Remove focus to avoid annoying flickering effect

The focus introduced on the 16.0 migration is causing a flickering effect
that is a bit annoying and does not make complete sense, because if you
click more than once the cursor is positioned at the end of the text,
which makes it difficult to edit the input.

The counterpart of these changes is that to edit the input using the
keyboard we will have to click on the field. Although this is how the
module has been operating since its inception.
pull/2909/head
Carlos Roca 2024-08-08 08:02:39 +02:00
parent 12ba87cb84
commit 087ea08d0c
1 changed files with 0 additions and 5 deletions

View File

@ -4,17 +4,12 @@ import {registry} from "@web/core/registry";
import {standardFieldProps} from "@web/views/fields/standard_field_props"; import {standardFieldProps} from "@web/views/fields/standard_field_props";
import {_lt} from "@web/core/l10n/translation"; import {_lt} from "@web/core/l10n/translation";
import {FloatField} from "@web/views/fields/float/float_field"; import {FloatField} from "@web/views/fields/float/float_field";
import {hasTouch} from "@web/core/browser/feature_detection";
export class NumericStep extends FloatField { export class NumericStep extends FloatField {
setup() { setup() {
super.setup(); super.setup();
} }
_onStepClick(ev) { _onStepClick(ev) {
const $el = $(ev.target).parent().parent().find("input");
if (!hasTouch()) {
$el.focus();
}
const mode = $(ev.target).data("mode"); const mode = $(ev.target).data("mode");
this._doStep(mode); this._doStep(mode);
} }