Skip to content

Commit a10329d

Browse files
committed
feat(aria/combobox): adds disabled combobox to dev-app
Updates dev-app to add disabled combobox using the proposed disabled bindings to aria/combobox.ts.
1 parent c75754b commit a10329d

File tree

6 files changed

+57
-0
lines changed

6 files changed

+57
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<div ngCombobox #combobox="ngCombobox" [disabled]="true" class="example-combobox-container">
2+
<div class="example-combobox-input-container">
3+
<span class="material-symbols-outlined example-icon example-search-icon" aria-hidden="true">search</span>
4+
<input
5+
ngComboboxInput
6+
placeholder="Search is disabled"
7+
aria-label="Search is disabled"
8+
[(value)]="searchString"
9+
class="example-combobox-input"
10+
/>
11+
</div>
12+
13+
<div popover="manual" #popover class="example-popover">
14+
<ng-template ngComboboxPopupContainer>
15+
</ng-template>
16+
</div>
17+
</div>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.dev/license
7+
*/
8+
9+
import {Combobox, ComboboxInput, ComboboxPopupContainer} from '@angular/aria/combobox';
10+
import {Component, signal} from '@angular/core';
11+
12+
/** @title Combobox disabled example. */
13+
@Component({
14+
selector: 'combobox-disabled-example',
15+
templateUrl: 'combobox-disabled-example.html',
16+
styleUrl: '../combobox-examples.css',
17+
imports: [Combobox, ComboboxInput, ComboboxPopupContainer],
18+
})
19+
export class ComboboxDisabledExample {
20+
searchString = signal('Search is disabled');
21+
}

src/components-examples/aria/combobox/combobox-examples.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,14 @@ ul[role='group'] {
147147
.example-tree-item[aria-selected='true'] .example-selected-icon {
148148
visibility: visible;
149149
}
150+
151+
[ngCombobox][aria-disabled='true'] {
152+
opacity: 0.5;
153+
pointer-events: none;
154+
cursor: default;
155+
}
156+
157+
[ngCombobox][aria-disabled='true'] input.example-combobox-input {
158+
color: var(--mat-sys-on-surface-variant);
159+
background-color: var(--mat-sys-surface);
160+
}

src/components-examples/aria/combobox/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ export {ComboboxHighlightExample} from './combobox-highlight/combobox-highlight-
44
export {ComboboxTreeManualExample} from './combobox-tree-manual/combobox-tree-manual-example';
55
export {ComboboxTreeAutoSelectExample} from './combobox-tree-auto-select/combobox-tree-auto-select-example';
66
export {ComboboxTreeHighlightExample} from './combobox-tree-highlight/combobox-tree-highlight-example';
7+
export {ComboboxDisabledExample} from './combobox-disabled/combobox-disabled.example';

src/dev-app/aria-combobox/combobox-demo.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,10 @@ <h2>Combobox with tree popup and auto-select filtering</h2>
2929
<h2>Combobox with tree popup and highlight filtering</h2>
3030
<combobox-tree-highlight-example></combobox-tree-highlight-example>
3131
</div>
32+
33+
<div class="example-combobox-container">
34+
<h2>Combobox disabled example</h2>
35+
<combobox-disabled-example></combobox-disabled-example>
36+
</div>
3237
</div>
3338
</div>

src/dev-app/aria-combobox/combobox-demo.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import {
1010
ComboboxAutoSelectExample,
11+
ComboboxDisabledExample,
1112
ComboboxHighlightExample,
1213
ComboboxManualExample,
1314
ComboboxTreeAutoSelectExample,
@@ -26,6 +27,7 @@ import {ChangeDetectionStrategy, Component} from '@angular/core';
2627
ComboboxTreeManualExample,
2728
ComboboxTreeAutoSelectExample,
2829
ComboboxTreeHighlightExample,
30+
ComboboxDisabledExample,
2931
],
3032
changeDetection: ChangeDetectionStrategy.OnPush,
3133
})

0 commit comments

Comments
 (0)