availity-react icon indicating copy to clipboard operation
availity-react copied to clipboard

eventModifiers prop on Analytics component not working as expected

Open danielpickett opened this issue 2 years ago • 0 comments

🐛 Bug report

Regarding the 'eventModifiers' prop on the Analytics component from @availity/analytics: it does not work, as far as I can tell.

Current Behavior

I cannot get this prop to do anything useful. It's also unclear from the docs exactly how to use it.

Expected behavior

From the docs, I would expect that this prop would allow me to track any DOM element event I specify, outside of the 'click', 'focus' and 'blur' events already available through the data-analytics-action attribute. So I tried

<Analytics plugins={[splunkPlugin]} eventModifiers={['mouseenter']}>
  <div data-analytics-mouseenter="mouseenter">mouseenter</div>
</Analytics>

and

<Analytics plugins={[splunkPlugin]} eventModifiers={['mouseenter']}>
  <div data-analytics-action="mouseenter">mouseenter</div>
</Analytics>

and several other variations. Nothing worked.

Looking through the code for the AvAnalytics class that this implements, I don't see how listeners for any events other than 'click', 'focus' or 'blur' would ever get added. So my theory is that this became broken during a refactor at some point, or maybe it never worked.

danielpickett avatar Mar 21 '22 14:03 danielpickett