Skip to content

Fix permission form group toggle broken by Alpine CSP build#77

Merged
mlissner merged 2 commits intomainfrom
fix-alpine-csp-permission-form-20260327
Mar 28, 2026
Merged

Fix permission form group toggle broken by Alpine CSP build#77
mlissner merged 2 commits intomainfrom
fix-alpine-csp-permission-form-20260327

Conversation

@mlissner
Copy link
Copy Markdown
Member

@mlissner mlissner commented Mar 28, 2026

Fixes

This fixes the bug where selecting the "Group" radio button on the directory/page permissions form had no effect — the group dropdown stayed hidden and only the "Username" input was visible, making it impossible to grant group permissions.

Summary

The @change="setTarget('group')" event handler passed an argument, which is an inline expression unsupported by @alpinejs/csp. This caused the Alpine state to never update when clicking the radio buttons.

Fix: Replace the single setTarget(value) method with separate setUser() / setGroup() methods so event handlers are simple method references (@change="setGroup"), which the CSP build supports.

Also adds an explicit rule to CLAUDE.md documenting that event handlers must never pass arguments in the CSP build, to prevent this class of bug in the future.

Deployment

This PR should:

  • skip-deploy (skips everything below)
    • skip-web-deploy
    • skip-daemon-deploy

mlissner and others added 2 commits March 27, 2026 22:16
The @change="setTarget('group')" event handler passed an argument,
which is an inline expression unsupported by @alpinejs/csp. This
caused the user/group radio toggle to silently fail — clicking
"Group" never updated Alpine state, so the group <select> stayed
hidden and users saw only the username field.

Replace the single setTarget(value) method with separate setUser()
and setGroup() methods so event handlers are simple method references.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add explicit guidance that event handlers must not pass arguments
(e.g., @click="doThing('arg')") since the CSP build only supports
simple method references. This was the root cause of the permission
form bug.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mlissner mlissner marked this pull request as ready for review March 28, 2026 05:17
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — clean, minimal fix for the Alpine CSP argument-passing limitation.

Extended reasoning...

Overview

Touches three files: the JS component (alpine-components.js), its corresponding template (_permission_form.html), and CLAUDE.md. The change replaces a single parameterized setTarget(value) method with two no-argument methods (setUser / setGroup), then updates the template event bindings accordingly.

Security Risks

None. This is a UI-only fix with no auth, data-access, or server-side changes. The Alpine state only controls which form field is visible — the server validates the submitted form independently.

Level of Scrutiny

Low. The pattern being applied (feedbackTabs already uses setComment / setPropose in the same file) is already established in the codebase. The fix is a direct translation of the broken parameterized call into the idiomatic CSP-safe form.

Other Factors

No bugs were found. The CLAUDE.md addition codifies the rule to prevent recurrence. The changes are self-contained, reversible, and touch no shared infrastructure.

@mlissner mlissner merged commit 4db4981 into main Mar 28, 2026
9 checks passed
@mlissner mlissner deleted the fix-alpine-csp-permission-form-20260327 branch March 28, 2026 05:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant