Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
richardhj opened this issue Sep 23, 2024 · 1 comment
Open

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

richardhj opened this issue Sep 23, 2024 · 1 comment

Comments

@richardhj
Copy link
Contributor

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?

if (!['input', 'change'].includes(modifier.value)) {
throw new Error(
`The "on" modifier in ${modelDirective.getString()} only accepts the arguments "input" or "change".`
);

2024-07-13 00 27 38

@smnandre
Copy link
Collaborator

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!

live-date-debounce.mov

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants