Skip to content

Commit 0bc9f76

Browse files
committed
fix(properties): replace default-font-id datalist with a select
The text input with list="zpl-default-font-ids" hit a browser datalist quirk: after a datalist suggestion has been picked and the component re-renders (e.g. when a Labelary preview kicks in), Chrome and Firefox keep the previous suggestion bound to the input and the next keystroke gets discarded. The field looked editable but onChange stopped firing. Replaces the input with a real select that lists the same union of font IDs (built-ins + every ^CW alias + every preview binding), plus an explicit "(none)" option for clearing the default. Selects do not carry the autocomplete state that broke the datalist input, so the field stays responsive across re-renders. Drops the now-unused datalist element and adds the new label.defaultFontIdNone locale key across all 32 locales.
1 parent 923984c commit 0bc9f76

33 files changed

Lines changed: 42 additions & 10 deletions

‎src/components/Properties/PropertiesPanel.tsx‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -769,16 +769,21 @@ function LabelConfigPanel({
769769
<label className="text-[10px] text-muted">
770770
{t.label.defaultFontId}
771771
</label>
772-
<input
773-
type="text"
772+
<select
774773
className={inputCls}
775-
maxLength={2}
776-
list="zpl-default-font-ids"
777774
value={label.defaultFontId ?? ""}
778775
onChange={(e) =>
779776
onUpdate({ defaultFontId: e.target.value || undefined })
780777
}
781-
/>
778+
>
779+
<option value="">{t.label.defaultFontIdNone}</option>
780+
{fontIdOptions.map((opt) => (
781+
<option key={opt.value} value={opt.value}>
782+
{opt.value}
783+
{opt.label ? ` — ${opt.label}` : ""}
784+
</option>
785+
))}
786+
</select>
782787
</div>
783788
<div className="flex flex-col gap-1">
784789
<label className="text-[10px] text-muted">
@@ -817,11 +822,6 @@ function LabelConfigPanel({
817822
</div>
818823
</CollapsibleSection>
819824
</div>
820-
<datalist id="zpl-default-font-ids">
821-
{fontIdOptions.map((opt) => (
822-
<option key={opt.value} value={opt.value} label={opt.label} />
823-
))}
824-
</datalist>
825825
</div>
826826
);
827827
}

‎src/locales/ar.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ const ar = {
118118
mirror: 'صورة معكوسة',
119119
defaultFont: 'نمط النص الافتراضي',
120120
defaultFontId: 'الخط',
121+
defaultFontIdNone: '(لا شيء)',
121122
defaultFontHeight: 'الارتفاع (نقاط)',
122123
defaultFontWidth: 'العرض (dots)',
123124
customFontsHeading: 'خطوط مخصصة',

‎src/locales/bg.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ const bg = {
118118
mirror: 'Огледален образ',
119119
defaultFont: 'Стил на текст по подразбиране',
120120
defaultFontId: 'Шрифт',
121+
defaultFontIdNone: '(няма)',
121122
defaultFontHeight: 'Височина (точки)',
122123
defaultFontWidth: 'Ширина (dots)',
123124
customFontsHeading: 'Персонализирани шрифтове',

‎src/locales/cs.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ const cs = {
118118
mirror: 'Zrcadlový obraz',
119119
defaultFont: 'Výchozí styl textu',
120120
defaultFontId: 'Písmo',
121+
defaultFontIdNone: '(žádné)',
121122
defaultFontHeight: 'Výška (body)',
122123
defaultFontWidth: 'Šířka (dots)',
123124
customFontsHeading: 'Vlastní písma',

‎src/locales/da.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ const da = {
118118
mirror: 'Spejlbillede',
119119
defaultFont: 'Standardtekststil',
120120
defaultFontId: 'Skrifttype',
121+
defaultFontIdNone: '(ingen)',
121122
defaultFontHeight: 'Højde (punkter)',
122123
defaultFontWidth: 'Bredde (dots)',
123124
customFontsHeading: 'Tilpassede skrifttyper',

‎src/locales/de.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ const de = {
118118
mirror: 'Spiegelbild',
119119
defaultFont: 'Standard-Textstil',
120120
defaultFontId: 'Schriftart',
121+
defaultFontIdNone: '(keine)',
121122
defaultFontHeight: 'Höhe (Punkte)',
122123
defaultFontWidth: 'Breite (dots)',
123124
customFontsHeading: 'Eigene Schriften',

‎src/locales/el.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ const el = {
118118
mirror: 'Καθρεπτική εικόνα',
119119
defaultFont: 'Προεπιλεγμένο στυλ κειμένου',
120120
defaultFontId: 'Γραμματοσειρά',
121+
defaultFontIdNone: '(κανένα)',
121122
defaultFontHeight: 'Ύψος (κουκκίδες)',
122123
defaultFontWidth: 'Πλάτος (dots)',
123124
customFontsHeading: 'Προσαρμοσμένες γραμματοσειρές',

‎src/locales/en.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ const en = {
118118
mirror: 'Mirror image',
119119
defaultFont: 'Default text style',
120120
defaultFontId: 'Font',
121+
defaultFontIdNone: '(none)',
121122
defaultFontHeight: 'Height (dots)',
122123
defaultFontWidth: 'Width (dots)',
123124
customFontsHeading: 'Custom fonts',

‎src/locales/es.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ const es = {
118118
mirror: 'Imagen reflejada',
119119
defaultFont: 'Estilo de texto predeterminado',
120120
defaultFontId: 'Fuente',
121+
defaultFontIdNone: '(ninguna)',
121122
defaultFontHeight: 'Altura (puntos)',
122123
defaultFontWidth: 'Ancho (dots)',
123124
customFontsHeading: 'Fuentes personalizadas',

‎src/locales/et.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ const et = {
118118
mirror: 'Peegelpilt',
119119
defaultFont: 'Vaikimisi teksti stiil',
120120
defaultFontId: 'Font',
121+
defaultFontIdNone: '(puudub)',
121122
defaultFontHeight: 'Kõrgus (punktid)',
122123
defaultFontWidth: 'Laius (dots)',
123124
customFontsHeading: 'Kohandatud fondid',

0 commit comments

Comments
 (0)