{
+ const options = Array.from(event.currentTarget.querySelectorAll
('[role="option"]'));
+ const index = options.indexOf(document.activeElement as HTMLButtonElement);
+ const targets: Record = {
+ ArrowUp: index - 1, ArrowDown: index + 1, Home: 0, End: options.length - 1,
+ };
+ const target = targets[event.key];
+ if (target === undefined || options.length === 0) return;
+ event.preventDefault();
+ options[wrapIndex(target, options.length)].focus();
+ }}
className="max-h-[min(16rem,var(--radix-popover-content-available-height))] overflow-y-auto py-1 scrollbar-thin scrollbar-track-transparent"
>
- {presets.map((preset) => (
+ {pickerPresets.map((preset) => (
@@ -450,10 +466,12 @@ export function ModelPresetBadge({
function PresetOption({
preset,
+ label,
selected,
onSelect,
}: {
preset: ModelPresetOption;
+ label: string;
selected: boolean;
onSelect: (name: string) => void;
}) {
@@ -462,7 +480,7 @@ function PresetOption({