DaAnalyst
Has anyone noticed that upon handling a phx-blur event on input text element as a result of the browser window losing focus, LiveView fails to update the field? The handle_event is processed, but the DOM is simply not updated.
To repeat this bug, have a number of input fields without the form’s phx-change event and have each input text with the blur event. Have the the values obtained in the handle_event function upcased before changing the state (so that all input elements caps the text when losing focus). When focus is lost by clicking or by pressing tab key in the same window, all is well but the field that has focus when another window is activated will not be updated by LiveView. If using pubsub and another browser window to view changes, the I-believe-is-a-bug will become all the more obvious.
I am running Elixir 1.9.0, Phoenix 1.14.11, LiveView 0.4.1 on Windows.
TIA
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex











Showing Posts 1 to 3- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
lardcanoe
Apologies for posting to an ancient question, but I also had this problem and eventually found this note:
Felt I should share for others stumbling on this.
garrison
I traced the focus check back to this document.activeElement call, so it does not appear to actually use focus/blur events at all. A hunch: is
document.activeElementpreserved when the tab is blurred?I have never run into this but I find this behavior quite surprising, to the point where I might call it a bug. At least in the documentation, which explicitly mentions focus.
rhcarvalho
The problem is that if the server would blindly update the current state, without some form of clock alignment, then we could end up in a situation that the user’s input gets changed unexpectedly. Specially easy to observe with higher latency between client and server.