Header: give the cart badge a stable id for islands
The badge is absolute inside the fixed-size cart button, so showing it or growing from 1 to 2 digits doesn't move the header. Adds #cart-badge as a Turbo Stream target and records the rule that no island may change the size of its container. cart-count-controller is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e4dccd0205
commit
6948c134e3
1 file changed
+6
@@ -74,7 +74,13 @@ class="relative flex items-center justify-center w-10 h-10 hover:opacity-70 tran
|
||||
data-action="cart-count#open"
|
||||
>
|
||||
<x-ui.icon name="bag" :size="40" />
|
||||
{{-- Island target: the count will come from the islands request
|
||||
(Turbo Stream on #cart-badge). It's absolute inside the
|
||||
fixed-size button, so showing it or going from 1 to 2 digits
|
||||
never moves the header. Rule for every island: it may never
|
||||
change the size of its container. --}}
|
||||
<span
|
||||
id="cart-badge"
|
||||
data-cart-count-target="badge"
|
||||
class="absolute -top-1 -right-2 text-sm font-bold leading-none"
|
||||
hidden
|
||||
|
||||
Reference in new issue
Block a user