fix(presentation): localize default fallbacks and keep SearchField focus (Q-6.8-13c)
The render boundary's default fallback reads the current locale instead of formatting ko-KR, and resolveMessage's "message unavailable" fallback comes from the requested locale's catalog (ko-KR only as a last resort). SearchField's clear button moves focus to the input before it unmounts, so focus no longer drops to the body. tests/unit/i18n-contract.test.ts expected the Korean fallback for en-US, which encoded the bug; it now expects the English copy and keeps a ko-KR case. New component cases for the boundary fallback and SearchField (RED: 3 failed before the change); lane gates pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
cc1c7d879c
commit
72b1a72c81
@@ -2,6 +2,7 @@ import {
|
||||
forwardRef,
|
||||
useEffect,
|
||||
useId,
|
||||
useImperativeHandle,
|
||||
useRef,
|
||||
useState,
|
||||
} from "react";
|
||||
@@ -373,6 +374,8 @@ export const SearchField = forwardRef<HTMLInputElement, SearchFieldProps>(
|
||||
},
|
||||
ref,
|
||||
) {
|
||||
const inputRef = useRef<HTMLInputElement | null>(null);
|
||||
useImperativeHandle(ref, () => inputRef.current as HTMLInputElement);
|
||||
return (
|
||||
<div className={`ui-search-field ${className}`.trim()}>
|
||||
<SearchIcon />
|
||||
@@ -390,7 +393,7 @@ export const SearchField = forwardRef<HTMLInputElement, SearchFieldProps>(
|
||||
aria-invalid={invalid || undefined}
|
||||
className="ui-field__input"
|
||||
id={controlId}
|
||||
ref={ref}
|
||||
ref={inputRef}
|
||||
type="search"
|
||||
value={value}
|
||||
/>
|
||||
@@ -399,7 +402,12 @@ export const SearchField = forwardRef<HTMLInputElement, SearchFieldProps>(
|
||||
{String(value ?? "").length > 0 ? (
|
||||
<IconButton
|
||||
accessibleName={clearLabel}
|
||||
onClick={onClear}
|
||||
onClick={() => {
|
||||
onClear();
|
||||
// The button unmounts once the value is empty; keep focus in
|
||||
// the field instead of dropping it to the body.
|
||||
inputRef.current?.focus();
|
||||
}}
|
||||
variant="ghost"
|
||||
>
|
||||
<CloseIcon />
|
||||
|
||||
Reference in New Issue
Block a user