Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/aria/combobox/combobox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {toSignal} from '@angular/core/rxjs-interop';
},
],
host: {
'[attr.aria-disabled]': 'disabled()',
'[attr.data-expanded]': 'pattern.expanded()',
'(input)': 'pattern.onInput($event)',
'(keydown)': 'pattern.onKeydown($event)',
Expand Down Expand Up @@ -119,6 +120,7 @@ export class Combobox<V> {
'[attr.aria-controls]': 'combobox.pattern.popupId()',
'[attr.aria-haspopup]': 'combobox.pattern.hasPopup()',
'[attr.aria-autocomplete]': 'combobox.pattern.autocomplete()',
'[disabled]': 'combobox.disabled()',
},
})
export class ComboboxInput {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<div ngCombobox #combobox="ngCombobox" [disabled]="true" class="example-combobox-container">
<div class="example-combobox-input-container">
<span class="material-symbols-outlined example-icon example-search-icon" aria-hidden="true">search</span>
<input
ngComboboxInput
placeholder="Search is disabled"
aria-label="Search is disabled"
[(value)]="searchString"
class="example-combobox-input"
/>
</div>

<div popover="manual" #popover class="example-popover">
<ng-template ngComboboxPopupContainer>
</ng-template>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/

import {Combobox, ComboboxInput, ComboboxPopupContainer} from '@angular/aria/combobox';
import {Component, signal} from '@angular/core';

/** @title Combobox disabled example. */
@Component({
selector: 'combobox-disabled-example',
templateUrl: 'combobox-disabled-example.html',
styleUrl: '../combobox-examples.css',
imports: [Combobox, ComboboxInput, ComboboxPopupContainer],
})
export class ComboboxDisabledExample {
searchString = signal('Search is disabled');
}
11 changes: 11 additions & 0 deletions src/components-examples/aria/combobox/combobox-examples.css
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,14 @@ ul[role='group'] {
.example-tree-item[aria-selected='true'] .example-selected-icon {
visibility: visible;
}

[ngCombobox][aria-disabled='true'] {
opacity: 0.5;
pointer-events: none;
cursor: default;
}

[ngCombobox][aria-disabled='true'] input.example-combobox-input {
color: var(--mat-sys-on-surface-variant);
background-color: var(--mat-sys-surface);
}
Comment on lines +151 to +160
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are these colors coming from? Should they match these ones? https://m3.material.io/components/text-fields/specs

1 change: 1 addition & 0 deletions src/components-examples/aria/combobox/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ export {ComboboxHighlightExample} from './combobox-highlight/combobox-highlight-
export {ComboboxTreeManualExample} from './combobox-tree-manual/combobox-tree-manual-example';
export {ComboboxTreeAutoSelectExample} from './combobox-tree-auto-select/combobox-tree-auto-select-example';
export {ComboboxTreeHighlightExample} from './combobox-tree-highlight/combobox-tree-highlight-example';
export {ComboboxDisabledExample} from './combobox-disabled/combobox-disabled.example';
5 changes: 5 additions & 0 deletions src/dev-app/aria-combobox/combobox-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,10 @@ <h2>Combobox with tree popup and auto-select filtering</h2>
<h2>Combobox with tree popup and highlight filtering</h2>
<combobox-tree-highlight-example></combobox-tree-highlight-example>
</div>

<div class="example-combobox-container">
<h2>Combobox disabled example</h2>
<combobox-disabled-example></combobox-disabled-example>
</div>
</div>
</div>
2 changes: 2 additions & 0 deletions src/dev-app/aria-combobox/combobox-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import {
ComboboxAutoSelectExample,
ComboboxDisabledExample,
ComboboxHighlightExample,
ComboboxManualExample,
ComboboxTreeAutoSelectExample,
Expand All @@ -26,6 +27,7 @@ import {ChangeDetectionStrategy, Component} from '@angular/core';
ComboboxTreeManualExample,
ComboboxTreeAutoSelectExample,
ComboboxTreeHighlightExample,
ComboboxDisabledExample,
],
changeDetection: ChangeDetectionStrategy.OnPush,
})
Expand Down
Loading