Skip to content

Commit 46baf08

Browse files
committed
fixup! fix(aria/combobox): add missing apis
1 parent 3c6075a commit 46baf08

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/aria/combobox/combobox.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ export class Combobox<V> {
7373
private _hasBeenFocused = signal(false);
7474

7575
/** Whether the combobox is disabled. */
76-
readonly isDisabled = input(false);
76+
readonly disabled = input(false);
7777

7878
/** Whether the combobox is read-only. */
79-
readonly isReadonly = input(false);
79+
readonly readonly = input(false);
8080

8181
/** The value of the first matching item in the popup. */
8282
readonly firstMatch = input<V | undefined>(undefined);
@@ -85,8 +85,8 @@ export class Combobox<V> {
8585
readonly pattern = new ComboboxPattern<any, V>({
8686
...this,
8787
textDirection: this.textDirection,
88-
disabled: this.isDisabled,
89-
readonly: this.isReadonly,
88+
disabled: this.disabled,
89+
readonly: this.readonly,
9090
inputValue: signal(''),
9191
inputEl: signal(undefined),
9292
containerEl: () => this._elementRef.nativeElement,

src/aria/ui-patterns/combobox/combobox.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ export class ComboboxPattern<T extends ListItem<V>, V> {
144144
/** The ARIA role of the popup associated with the combobox. */
145145
hasPopup = computed(() => this.inputs.popupControls()?.role() || null);
146146

147+
/** Whether the combobox is interactive. */
148+
isInteractive = computed(() => !this.inputs.disabled() && !this.inputs.readonly());
149+
147150
/** The keydown event manager for the combobox. */
148151
keydown = computed(() => {
149152
if (!this.expanded()) {
@@ -215,21 +218,21 @@ export class ComboboxPattern<T extends ListItem<V>, V> {
215218

216219
/** Handles keydown events for the combobox. */
217220
onKeydown(event: KeyboardEvent) {
218-
if (!this.inputs.disabled() && !this.inputs.readonly()) {
221+
if (this.isInteractive()) {
219222
this.keydown().handle(event);
220223
}
221224
}
222225

223226
/** Handles pointerup events for the combobox. */
224227
onPointerup(event: PointerEvent) {
225-
if (!this.inputs.disabled() && !this.inputs.readonly()) {
228+
if (this.isInteractive()) {
226229
this.pointerup().handle(event);
227230
}
228231
}
229232

230233
/** Handles input events for the combobox. */
231234
onInput(event: Event) {
232-
if (this.inputs.disabled() || this.inputs.readonly()) {
235+
if (!this.isInteractive()) {
233236
return;
234237
}
235238

0 commit comments

Comments
 (0)