Fix hydration mismatch in progress bars on non-English browsers
Base UI formats aria-valuetext with the runtime locale (server: "50%", German browser: "50 %"). Pin the Progress wrapper to en-US. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6dc9527682
commit
5211ec9064
1 file changed
+4
@@ -7,11 +7,15 @@ function Progress({
|
|||||||
className,
|
className,
|
||||||
children,
|
children,
|
||||||
value,
|
value,
|
||||||
|
// Fixed locale: the default (runtime locale) formats aria-valuetext differently on the server
|
||||||
|
// and in e.g. a German browser ("50%" vs "50 %"), which breaks hydration.
|
||||||
|
locale = "en-US",
|
||||||
...props
|
...props
|
||||||
}: ProgressPrimitive.Root.Props) {
|
}: ProgressPrimitive.Root.Props) {
|
||||||
return (
|
return (
|
||||||
<ProgressPrimitive.Root
|
<ProgressPrimitive.Root
|
||||||
value={value}
|
value={value}
|
||||||
|
locale={locale}
|
||||||
data-slot="progress"
|
data-slot="progress"
|
||||||
className={cn("flex flex-wrap gap-3", className)}
|
className={cn("flex flex-wrap gap-3", className)}
|
||||||
{...props}
|
{...props}
|
||||||
|
|||||||
Reference in new issue
Block a user