diff --git a/acrobat/blocks/verb-widget/verb-widget.js b/acrobat/blocks/verb-widget/verb-widget.js index da45e479..e8ef410e 100644 --- a/acrobat/blocks/verb-widget/verb-widget.js +++ b/acrobat/blocks/verb-widget/verb-widget.js @@ -105,11 +105,6 @@ export default async function init(element) { verbAnalytics('dropzone:choose-file-clicked', VERB); }); - button.addEventListener('change', (e) => { - verbAnalytics('choose-file:open', VERB); - e.target.value = ''; - }); - button.addEventListener('cancel', () => { verbAnalytics('choose-file:close', VERB); }); @@ -123,14 +118,18 @@ export default async function init(element) { setDraggingClass(widget, false); }); - widget.addEventListener('drop', (e) => { - e.preventDefault(); - verbAnalytics('files-dropped', VERB); - setDraggingClass(widget, false); - }); - errorCloseBtn.addEventListener('click', () => { errorState.classList.remove('verb-error'); errorState.classList.add('hide'); }); + + window.addEventListener('unity:track-analytics', (e) => { + if (e.detail.event === 'change') { + verbAnalytics('choose-file:open', VERB); + } + if (e.detail.event === 'drop') { + verbAnalytics('files-dropped', VERB); + setDraggingClass(widget, false); + } + }); }