mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-25 21:00:28 -05:00
Fix global search flicker
This commit is contained in:
@@ -18,6 +18,7 @@ export function SendouRadioGroup({
|
||||
isDisabled,
|
||||
className,
|
||||
"aria-label": ariaLabel,
|
||||
onMouseDown,
|
||||
children,
|
||||
}: {
|
||||
value: string | null;
|
||||
@@ -25,12 +26,18 @@ export function SendouRadioGroup({
|
||||
isDisabled?: boolean;
|
||||
className?: string;
|
||||
"aria-label"?: string;
|
||||
onMouseDown?: (e: React.MouseEvent) => void;
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const name = React.useId();
|
||||
|
||||
return (
|
||||
<div role="radiogroup" aria-label={ariaLabel} className={className}>
|
||||
<div
|
||||
role="radiogroup"
|
||||
aria-label={ariaLabel}
|
||||
className={className}
|
||||
onMouseDown={onMouseDown}
|
||||
>
|
||||
<RadioGroupContext value={{ name, value, isDisabled, onChange }}>
|
||||
{children}
|
||||
</RadioGroupContext>
|
||||
|
||||
@@ -343,6 +343,7 @@ function GlobalSearchContent({
|
||||
onChange={handleSearchTypeChange}
|
||||
aria-label="Search type"
|
||||
className={styles.searchTypeRadioGroup}
|
||||
onMouseDown={preventFocusLeavingInput}
|
||||
>
|
||||
{SEARCH_TYPES.map((type) => (
|
||||
<SendouRadio
|
||||
@@ -418,6 +419,10 @@ function GlobalSearchContent({
|
||||
);
|
||||
}
|
||||
|
||||
function preventFocusLeavingInput(e: React.MouseEvent) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
type SearchResult = NonNullable<SearchLoaderData>["results"][number];
|
||||
|
||||
function getResultKey(result: SearchResult): string {
|
||||
|
||||
4
changelog/2026-09-23-global-search-tab-flicker.md
Normal file
4
changelog/2026-09-23-global-search-tab-flicker.md
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
type: bug
|
||||
---
|
||||
Switching tabs in search no longer makes the search field flicker
|
||||
Reference in New Issue
Block a user