Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

fixes #2539, show all possible font weight options for local fonts or unknown fontFamily

Amruth Pillai6658412f8bd6
diff --git a/src/components/typography/combobox.tsx b/src/components/typography/combobox.tsx
index ed937573d..2438fe7d7 100644
--- a/src/components/typography/combobox.tsx
+++ b/src/components/typography/combobox.tsx
@@ -63,9 +63,17 @@ type FontWeightComboboxProps = Omit<MultipleComboboxProps, "options"> & { fontFa
export function FontWeightCombobox({ fontFamily, ...props }: FontWeightComboboxProps) {
const options = useMemo(() => {
const fontData = webFontMap.get(fontFamily);
- if (!fontData || !Array.isArray(fontData.weights)) return [];
- return fontData.weights.map((variant: string) => ({
+ let weights: string[] = [];
+
+ if (!fontData || !Array.isArray(fontData.weights)) {
+ // Provide all possible options for local fonts or unknown fontFamily
+ weights = ["100", "200", "300", "400", "500", "600", "700", "800", "900"];
+ } else {
+ weights = fontData.weights as string[];
+ }
+
+ return weights.map((variant: string) => ({
value: variant,
label: variant,
keywords: [variant],
diff --git a/src/components/ui/combobox.tsx b/src/components/ui/combobox.tsx
index d74478b06..1cd1f9fc1 100644
--- a/src/components/ui/combobox.tsx
+++ b/src/components/ui/combobox.tsx
@@ -117,11 +117,10 @@ function Combobox<TValue extends string | number = string>({
<PopoverContent
align="start"
+ aria-disabled={disabled}
+ tabIndex={disabled ? -1 : undefined}
className={cn("min-w-[200px] p-0", className, disabled && "pointer-events-none select-none opacity-60")}
{...props}
- // Hide popover content visually and functionally if disabled (prevent tab focus etc)
- tabIndex={disabled ? -1 : undefined}
- aria-disabled={disabled}
>
<Command>
<CommandInput placeholder={searchPlaceholder} disabled={disabled} />