Fix layout switches not showing their state on the combined docs page

On the combined Storybook docs page for the call footer, the layout switches would not show the correct state until you hovered over them because they all shared the same input name and thus were interpreted as belonging to the same radio group.
This commit is contained in:
Robin
2026-07-27 17:37:57 +02:00
parent 5a96d1769e
commit 2de7fdde10
2 changed files with 7 additions and 6 deletions

View File

@@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE in the repository root for full details. Please see LICENSE in the repository root for full details.
*/ */
import { type FC } from "react"; import { useId, type FC } from "react";
import { import {
SpotlightViewIcon, SpotlightViewIcon,
GridIcon, GridIcon,
@@ -24,10 +24,11 @@ interface Props {
export const LayoutSwitch: FC<Props> = ({ vm, className }) => { export const LayoutSwitch: FC<Props> = ({ vm, className }) => {
const { t } = useTranslation(); const { t } = useTranslation();
const layout = useBehavior(vm.layout$); const layout = useBehavior(vm.layout$);
const name = useId();
return ( return (
<Switch<"spotlight", "grid"> <Switch<"spotlight", "grid">
name="layout" name={name}
aria-label={t("layout_switch_label")} aria-label={t("layout_switch_label")}
leftLabel={t("layout_spotlight_label")} leftLabel={t("layout_spotlight_label")}
leftValue="spotlight" leftValue="spotlight"

View File

@@ -432,8 +432,8 @@ exports[`InCallView > rendering > renders 1`] = `
data-size="lg" data-size="lg"
> >
<input <input
aria-labelledby="_r_19_" aria-labelledby="_r_1a_"
name="layout" name="_r_19_"
type="radio" type="radio"
value="spotlight" value="spotlight"
/> />
@@ -452,9 +452,9 @@ exports[`InCallView > rendering > renders 1`] = `
/> />
</svg> </svg>
<input <input
aria-labelledby="_r_1e_" aria-labelledby="_r_1f_"
checked="" checked=""
name="layout" name="_r_19_"
type="radio" type="radio"
value="grid" value="grid"
/> />