mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-23 02:36:05 +00:00
fix(icon-input): show initial icons on focus for better discoverability #5997
When users click on the icon input field, 50 icons now appear immediately instead of requiring the user to type first. This makes the icon selection more intuitive and discoverable.
This commit is contained in:
parent
929c474555
commit
9a1e0a2dd8
2 changed files with 15 additions and 0 deletions
|
|
@ -5,6 +5,7 @@
|
|||
<input
|
||||
[ngModel]="formControl.value"
|
||||
(ngModelChange)="onInputValueChange($event)"
|
||||
(focus)="onFocus()"
|
||||
(paste)="onPaste($event)"
|
||||
[formlyAttributes]="field"
|
||||
[matAutocomplete]="auto"
|
||||
|
|
|
|||
|
|
@ -64,6 +64,20 @@ export class IconInputComponent extends FieldType<FormlyFieldConfig> implements
|
|||
return i;
|
||||
}
|
||||
|
||||
onFocus(): void {
|
||||
// Show initial icons when field is focused and no filter applied yet
|
||||
if (this.filteredIcons().length === 0) {
|
||||
const currentValue = this.formControl.value || '';
|
||||
if (currentValue) {
|
||||
// If there's a current value, filter by it
|
||||
this.onInputValueChange(currentValue);
|
||||
} else {
|
||||
// Show first 50 icons when empty
|
||||
this.filteredIcons.set(MATERIAL_ICONS.slice(0, 50));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onInputValueChange(val: string): void {
|
||||
// Skip if this is the value we just set programmatically (prevents double processing)
|
||||
if (val === this._lastSetValue) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue