From a330e8cdde2993d9fb39562d047388223ef4494a Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Thu, 5 May 2022 15:05:43 +0200 Subject: [PATCH] Completer: Fix null data being emitted when triggering instrumented events --- asset/js/widget/Completer.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/asset/js/widget/Completer.js b/asset/js/widget/Completer.js index 2d8d1537..9a782ad0 100644 --- a/asset/js/widget/Completer.js +++ b/asset/js/widget/Completer.js @@ -240,9 +240,9 @@ define(["../notjQuery"], function ($) { }, 200); } - suggest(input, value, data = null) { + suggest(input, value, data = {}) { if (this.instrumented) { - if (data === null) { + if (! Object.keys(data).length) { data = value; } @@ -256,6 +256,10 @@ define(["../notjQuery"], function ($) { $(input).focus({ scripted: true }); if (this.instrumented) { + if (! Object.keys(data).length) { + data = value; + } + $(input).trigger('completion', data); } else { input.value = value;