Skip to content

Commit

Permalink
fix: disallow clearing the language input (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
GregoMac1 authored Sep 23, 2024
1 parent 783e407 commit bab09c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib/components/FieldSelect.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
export let options: OptionOrGroup[] = [];
export let value: string | undefined = undefined;
export let placeholder: string = '';
export let allowClear: boolean = true;
export let allowSearch: boolean = true;
export let onChange: (value: Option) => void = () => {};
type Option = Selected<string> & { badge?: string };
Expand Down Expand Up @@ -99,10 +101,11 @@
id={name}
disabled={isDisabled}
aria-labelledby={`${name}-label`}
readonly={allowSearch ? null : true}
/>

<nav class="field-select-nav">
{#if selected?.value}
{#if allowClear && selected?.value}
<Button
variant="icon"
on:click={handleClear}
Expand Down
2 changes: 2 additions & 0 deletions src/routes/settings/Interface.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
name="language"
label={$LL.language()}
bind:value
allowClear={false}
allowSearch={false}
onChange={() => changeLanguage(value)}
options={[
{ value: 'en', label: 'English' },
Expand Down

0 comments on commit bab09c5

Please sign in to comment.