fix: let a chip's @press handler actually fire - #80
Open
CodyPChristian wants to merge 1 commit into
Open
Conversation
Both chip renderers read only `on_change`. A chip written as
<chip label="…" :selected="…" @press="filterRole('admin')" />
registers the callback PHP-side — Element::onPress exists and
NativeElementCollector binds `_press` for every element — and then nothing
invokes it, because neither renderer looks for `on_press`. The chip toggles its
own local state and reports a boolean instead.
Nothing errors. The chip animates on tap, so it reads as working; the filter
simply never changes. In the QikCMS console this silently disabled the filter
row on THIRTEEN screens, People and Tickets among them.
A chip with a press handler is server-driven: the handler decides what becomes
selected, so it must not toggle locally, or a filter chip fights the state it
is handed back and flickers off on its own tap. Without a press handler the
existing self-toggling `@change` behaviour is untouched.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RWJoCjdX5Cy1V5VhaRKuLS
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.
A
<chip>readon_changebut neveron_press, so a press handler was silently ignored — the chip rendered, animated its selection, and told the server nothing.Why it can't just also send a change event
When a press handler exists, selection is server-driven: the handler decides what is selected and hands the state back. Toggling locally as well makes the chip fight the value it is given — a filter chip flickers off on its own tap, then snaps back when the server response lands.
So the two paths are exclusive:
on_pressset → send the press event only, and leaveisSelectedalone. The server owns it.on_change, unchanged.Applied to both
NativeUIChipRenderer.swiftandChipRenderer.ktso the platforms agree.Existing
@changechips are unaffected — that branch is untouched.