>({});
return (
@@ -648,15 +650,41 @@ function PlatformMembershipCycleSwitch({
role="radiogroup"
aria-label="付费周期"
className="platform-subpanel flex gap-1 rounded-full p-1"
+ onKeyDown={(event) => {
+ if (locked) {
+ return;
+ }
+ const currentIndex = options.findIndex(
+ (option) => option.id === cycleKind,
+ );
+ const nextIndex = resolveRovingIndex(
+ event.key,
+ currentIndex,
+ options.length,
+ );
+ if (nextIndex === null) {
+ return;
+ }
+ event.preventDefault();
+ const nextOption = options[nextIndex];
+ if (nextOption) {
+ onChange(nextOption.id);
+ optionRefs.current[nextOption.id]?.focus();
+ }
+ }}
>
{options.map((option) => {
const selected = option.id === cycleKind;
return (