phoenix_live_view icon indicating copy to clipboard operation
phoenix_live_view copied to clipboard

Log a message if we can't update an element's value that has focus

Open lardcanoe opened this issue 8 months ago • 2 comments

This is a follow up for https://github.com/phoenixframework/phoenix_live_view/issues/2163

The behavior of not updating an element that has focus is pretty subtle, and easy to miss in the docs.

I'm proposing logging a message when this happens. It really is only needed in development mode, and can probably be a debug message as well, I just wasn't sure the right way to do that in this code base. Happy to change.

But this has bitten so many people over the years that we at least should be warned that it happens. You can see the events in the console with the new value, but it doesn't update.

lardcanoe avatar Aug 15 '25 15:08 lardcanoe

Also noticed this right above it:

          const sourceValue = source.value ?? source.getAttribute(name);
          if (target.value === sourceValue) {
            // actually set the value attribute to sync it with the value property
            target.setAttribute("value", source.getAttribute(name));

Why set to source.getAttribute(name) and not use sourceValue?

lardcanoe avatar Aug 15 '25 15:08 lardcanoe

Why set to source.getAttribute(name) and not use sourceValue?

I think it's because we want to synchronize the actual attribute values. Most of the time those would be the same, but I'm currently not sure if it's always the case.

SteffenDE avatar Aug 17 '25 12:08 SteffenDE