phoenix_live_view icon indicating copy to clipboard operation
phoenix_live_view copied to clipboard

Disabled `phx-click` targets with children should not fire click events.

Open radglob opened this issue 3 years ago • 0 comments

If we define a phx-click event on an element with no children and set disabled on that element, phx-click will not fire. However, if that element has children, this is not the case.

Compare:

<button disabled phx-click="increment">+ 1</button>

to

<button disabled phx-click="toggle">
  <span class="material-icon">add</span>
</button>

In the first example, the event will not fire. In the second one, the event will fire. This doesn't adhere to standard HTML behavior.

I've tested this on <button> elements, but I imagine the behavior is fairly general.

radglob avatar Aug 10 '22 14:08 radglob