ux icon indicating copy to clipboard operation
ux copied to clipboard

[Live component] Data model binding "onblur" not available

Open richardhj opened this issue 1 year ago • 1 comments

Hi there!

I posted on this issue before in Slack 😄

In fact, I have a input type="date" that (as we know) has strange "onchange" behaviors.

My idea was to submit the field onblur, but this is not available. Is there a reason for doing so?

https://github.com/symfony/ux/blob/9209d8640a3004540f9abf3d34a9d5dc888371eb/src/LiveComponent/assets/src/Directive/get_model_binding.ts#L24-L27

2024-07-13 00 27 38

richardhj avatar Sep 23 '24 07:09 richardhj

The problem is that "blur" does not imply any change, and would probably be triggered too late in many cases..

Also, this is a browser "bug" in the end... and i'm not sure we want to try going against it ... :/

But, by setting a small debounce, the experience looks to me already much better!

https://github.com/user-attachments/assets/59f811fc-4004-4c56-9248-34bf78e1a3fd

What do you think ?

If this does not match what you want, you also can set a norender on change, and trigger the event manually from some custom JS script / Stimulus controller (see: https://symfony.com/bundles/ux-live-component/current/index.html#model-updates-don-t-work-when-external-javascript-changes-a-field)

smnandre avatar Sep 23 '24 21:09 smnandre