Skip to content

Fix Blaze folding flux:error as static hidden HTML in inline field templates#2564

Open
joshhanley wants to merge 2 commits intomainfrom
josh/fix-inline-field-validation-errors
Open

Fix Blaze folding flux:error as static hidden HTML in inline field templates#2564
joshhanley wants to merge 2 commits intomainfrom
josh/fix-inline-field-validation-errors

Conversation

@joshhanley
Copy link
Copy Markdown
Member

The Scenario

When Blaze is installed, validation errors on flux:checkbox, flux:radio, and flux:switch never render. The error div is folded as static hidden HTML at compile time and never re-evaluated at runtime.

<?php

use Livewire\Attributes\Validate;
use Livewire\Component;

new class extends Component {
    #[Validate('accepted')]
    public bool $terms = false;

    public function save()
    {
        $this->validate();
    }
}; ?>

<form wire:submit="save">
    <flux:checkbox label="Accept terms" wire:model="terms" />
    <flux:button type="submit">Submit</flux:button>
</form>

The Problem

with-inline-field.blade.php and with-reversed-inline-field.blade.php render flux:error directly inside a @blaze(fold: true) block without wrapping it in @unblaze. with-field.blade.php already handles this correctly.

The Solution

Wrap flux:error in @unblaze in both with-inline-field.blade.php and with-reversed-inline-field.blade.php, matching the existing pattern in with-field.blade.php.

Fixes #2560

The `flux:error` component inside `with-inline-field` and
`with-reversed-inline-field` was rendered directly within a
`@blaze(fold: true)` block. When Blaze is installed, this causes the
error div to be folded at compile time with a null name, permanently
hiding validation errors for checkboxes, radios, and switches.

This applies the same `@unblaze` pattern already used in
`with-field.blade.php`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

flux:checkbox validation errors never render (Blaze folds error div as static hidden HTML)

1 participant