You can’t access selectors like that when using the widget code (with a couple of exceptions).
The reason is the widgets can be re-rendered at any time and replaced with new HTML. So even if you added an attribute from some other process it would likely be painted over when it refreshed.
On the other hand, if you were able to create that data-* attribute as part of a decorator, you should already have it in attrs and you can access that in your action as this.attrs.