Component polish: search-picker on-focus, nav_tabs pulse, multilang auto switch-handler - #643
Merged
Conversation
The SearchPicker hook has always honored data-search-on-focus (open the dropdown in browse mode on click/focus of the EMPTY input — the boss's picker rule: offer options before any typing), but the component never exposed it: consumers had to know the raw data attribute and pass it through the global rest. It's now a documented boolean attr rendering that same attribute, with the raw form still honored for existing call sites. Off by default; without it a multi-mode picker also can't reopen after a pick clears the input.
Tab content that needs server work (e.g. a calendar tab computing schedules on first open) left the click without feedback. The event variant of the tab button now rides LiveView's phx-click-loading tag with an animate-pulse variant — pure class addition, no API change.
mount_multilang/2 now attaches a :handle_event hook (mirroring its existing
debounced :handle_info hook) that calls handle_switch_language/2 and halts, so
consumers no longer need their own def handle_event("switch_language", …)
clause. Forgetting that clause previously crashed the LiveView on the first
language-tab click — a silent footgun, since mount_multilang already wired the
other half of the switching protocol (the handle_info timer) automatically.
Existing consumers' manual clauses keep working (the hook halts first; the
clause becomes harmless dead code). Opt out with
mount_multilang(socket, auto_switch_language: false) when a form switches
language without the debounce (catalogue's import screen does this).
Also documents a storage footgun: merge_translatable_params/put_language_data
take over the schema's `data` JSONB (restructuring it into a per-language
shape), so schemas whose `data` holds unrelated keys must not point the helper
at `data` — use translatable_field's settings-translations mode instead.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
Merged and took into work and release |
ddon
pushed a commit
that referenced
this pull request
Jul 17, 2026
Closes a test-coverage gap on mount_multilang/2's new switch_language handle_event hook (and auto_switch_language: false opt-out) — the pre-existing handle_info hook it's modeled on had the same gap. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
ddon
pushed a commit
that referenced
this pull request
Jul 17, 2026
Multilang auto switch-language hook, search-picker on-focus attr, nav_tabs pulse feedback. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
ddon
pushed a commit
that referenced
this pull request
Jul 18, 2026
…7.201 Reviewed PR #645 (media picker circle, selector route shadowing, and a media-surface bug sweep) — clean pass, no findings. Fixed an unrelated pre-existing credo --strict failure (nested-module aliasing suggestion in multilang_form_test.exs from PR #643) that was silently preventing dialyzer from running as part of mix precommit. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
alexdont
pushed a commit
to alexdont/phoenix_kit
that referenced
this pull request
Jul 18, 2026
Credo --strict flagged three fully-qualified Phoenix.LiveView.Lifecycle calls (nested-module-alias suggestion) from PR BeamLabEU#643, which turned mix precommit red. Alias it at the top and use the short form. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MsjUy1HnuJnCSrqdbnANYL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Small component-polish / DX commits.
The first two came out of the projects calendar work (BeamLabEU/phoenix_kit_projects#30 uses both, but degrades gracefully without them); the third came out of the publishing group-name translation work.
search_on_focusattr on the search pickerThe SearchPicker hook has always honored
data-search-on-focus(open the dropdown in browse mode when the empty input is focused/clicked — offer options before any typing), but the component never exposed it: consumers had to know the raw data attribute and pass it through the global rest. It is now a documented boolean attr rendering that same attribute; the raw form keeps working for existing call sites.nav_tabs in-flight pulse
Tab buttons that push an event now pulse (
phx-click-loading→animate-pulse) while the switch is round-tripping, so a click on a slower tab is visibly acknowledged instead of appearing dead. Navigation-style tabs are unaffected.MultilangForm auto-handles the
"switch_language"eventmount_multilang/2now attaches a:handle_eventhook (mirroring its existing debounced:handle_infohook) that callshandle_switch_language/2and halts — so consumers no longer need their owndef handle_event("switch_language", …)clause. Forgetting that clause previously crashed the LiveView on the first language-tab click, a silent footgun sincemount_multilangalready wired the other half of the switching protocol (thehandle_infotimer) automatically.mount_multilang(socket, auto_switch_language: false)when a form switches language immediately, without the debounce (catalogue's import screen does this).merge_translatable_params/4/put_language_data/3take over the schema'sdataJSONB (restructuring it into a per-language shape), so schemas whosedataalready holds unrelated keys must not point the helper atdata— usetranslatable_field's settings-translations mode instead.Testing
mix test test/phoenix_kit_web/components/core/search_picker_test.exs— 6 tests, 0 failures (rebased onto current main, full compile clean with--warnings-as-errors).--warnings-as-errors); language-tab switching verified in-app via the publishing group-name edit form (tabs switch without any per-consumerswitch_languagehandler). All existing multilang consumers across the workspace delegate tohandle_switch_language/2, so the auto-hook is behaviour-preserving for them; the one immediate-switch consumer (catalogue import) opts out.