$ the-wire · showcase
LiveView preserves caret in more input types, Elixir changes type projection and guards
By RepoJournal · Filed · About Elixir & Phoenix · Composed from the cited sources · methodology
Phoenix LiveView now keeps the caret and selection intact when a patch re-focuses search, url, tel, and password inputs, while Elixir tightened two long-standing type and pattern behaviors.
Phoenix LiveView fixed a long-standing focus bug for inputs beyond text and textarea. The `hasSelectionRange` check only accepted `text` and `textarea`, but `setSelectionRange` is also valid for `search`, `url`, `tel`, and `password`. When a patch re-focused one of those inputs, focus was restored but the caret and selection were not, leaving the cursor at the start. The change makes caret preservation work for all valid input types [1], and the commit landed alongside an assets update that rebuilds the bundled JavaScript [2].
On the Elixir side, José Valim changed how atom keys are projected into expected types: projection now happens only when there are no other unions present, closing issue #15858 [3]. This narrows type inference for maps and keyword lists with mixed union branches, so code that relied on the previous broader projection may see different type results.
Elixir also added support for guards after patterns, closing issue #15717 [4]. Previously, guards written after a pattern in certain constructs were not processed; they now are, which changes how matching clauses with post-pattern guards are evaluated and compiled.
No security fixes or breaking CVE patches landed in the last 24 hours. The LiveView caret fix [5] is the only user-visible behavior change in that repo.
Action items
- → Bump phoenix_live_view to pick up caret preservation for search/url/tel/password inputs phoenixframework/phoenix_live_view [plan]
- → Re-run type checks if you rely on atom key projection in mixed-union maps or keyword lists elixir-lang/elixir [monitor]
- → Test pattern matching clauses that use guards after patterns before your next Elixir release elixir-lang/elixir [plan]
References
- [1] Preserve caret for additional input types ↗ phoenixframework/phoenix_live_view
- [2] Update assets ↗ phoenixframework/phoenix_live_view
- [3] Only project atom keys into expected types if there are no other unions, closes #15858 ↗ elixir-lang/elixir
- [4] Process guards after patterns, closes #15717 ↗ elixir-lang/elixir
- [5] Preserve caret for additional input types (#4436) ↗ phoenixframework/phoenix_live_view