diff --git a/projects/igniteui-angular/src/lib/combo/combo.component.html b/projects/igniteui-angular/src/lib/combo/combo.component.html index a64a4fbaf04..e2fc4d7a9fb 100644 --- a/projects/igniteui-angular/src/lib/combo/combo.component.html +++ b/projects/igniteui-angular/src/lib/combo/combo.component.html @@ -14,58 +14,58 @@ {{ item[key] }} -
- - - - clear - - - arrow_drop_down - - arrow_drop_up - - + + + + clear + + + arrow_drop_down + + arrow_drop_up + + + + + + - - - - - - -
- - - - - - - - - - - - - -
-
-
- + + +
+ + + + + + + -
- - + + + +
+
+
+ +
- - - -
+ + + + +
+ + +
\ No newline at end of file diff --git a/projects/igniteui-angular/src/lib/combo/combo.component.ts b/projects/igniteui-angular/src/lib/combo/combo.component.ts index 9c371553801..b5bd231f1cc 100644 --- a/projects/igniteui-angular/src/lib/combo/combo.component.ts +++ b/projects/igniteui-angular/src/lib/combo/combo.component.ts @@ -35,6 +35,7 @@ import { IgxComboFilterConditionPipe, IgxComboFilteringPipe, IgxComboGroupingPip import { OverlaySettings, AbsoluteScrollStrategy } from '../services'; import { Subscription } from 'rxjs'; import { DeprecateProperty } from '../core/deprecateDecorators'; +import { DisplayDensityBase, DisplayDensityToken, IDisplayDensityOptions } from '../core/density'; /** Custom strategy to provide the combo with callback on initial positioning */ class ComboConnectedPositionStrategy extends ConnectedPositioningStrategy { @@ -96,7 +97,7 @@ const noop = () => { }; selector: 'igx-combo', templateUrl: 'combo.component.html' }) -export class IgxComboComponent implements AfterViewInit, ControlValueAccessor, OnInit, OnDestroy { +export class IgxComboComponent extends DisplayDensityBase implements AfterViewInit, ControlValueAccessor, OnInit, OnDestroy { /** * @hidden */ @@ -168,7 +169,9 @@ export class IgxComboComponent implements AfterViewInit, ControlValueAccessor, O protected elementRef: ElementRef, protected cdr: ChangeDetectorRef, protected selection: IgxSelectionAPIService, - @Self() @Optional() public ngControl: NgControl) { + @Self() @Optional() public ngControl: NgControl, + @Optional() @Inject(DisplayDensityToken) protected _displayDensityOptions: IDisplayDensityOptions) { + super(_displayDensityOptions); if (this.ngControl) { // Note: we provide the value accessor through here, instead of // the `providers` to avoid running into a circular import. @@ -522,6 +525,26 @@ export class IgxComboComponent implements AfterViewInit, ControlValueAccessor, O return this._valid === IgxComboState.INVALID; } + @HostBinding('class.igx-combo') + public cssClass = 'igx-combo'; // Independant of display density, at the time being + + @HostBinding(`attr.role`) + public role = 'combobox'; + + @HostBinding('attr.aria-expanded') + public get ariaExpanded() { + return !this.dropdown.collapsed; + } + + @HostBinding('attr.aria-haspopup') + public get hasPopUp() { + return 'listbox'; + } + + @HostBinding('attr.aria-owns') + public get ariaOwns() { + return this.dropdown.id; + } /** * Controls whether custom values can be added to the collection * diff --git a/src/app/combo/combo.sample.html b/src/app/combo/combo.sample.html index 3d57ce7a7ef..7a461c8b720 100644 --- a/src/app/combo/combo.sample.html +++ b/src/app/combo/combo.sample.html @@ -20,6 +20,7 @@ (onAddition)="handleAddition($event)" [data]="items" [allowCustomValues]="true" + [displayDensity]="'comfortable'" [filterable]="true" [displayKey]="valueKeyVar" [valueKey]="valueKeyVar" [groupKey]="valueKeyVar ? 'region' : ''" [width]="'100%'"> @@ -61,6 +62,12 @@
+
+

Display Density

+ + + +
diff --git a/src/app/combo/combo.sample.ts b/src/app/combo/combo.sample.ts index 4fdc699e818..ffe254313b8 100644 --- a/src/app/combo/combo.sample.ts +++ b/src/app/combo/combo.sample.ts @@ -121,4 +121,8 @@ export class ComboSampleComponent implements OnInit { this.igxCombo.itemTemplate = this.initialItemTemplate ? this.initialItemTemplate : this.customItemTemplate ; this.initialItemTemplate = comboTemplate; } + + setDensity(density: string) { + this.igxCombo.displayDensity = density; + } }