Skip to content

Commit 0ad2f3c

Browse files
authored
Merge branch 'master' into bpenkov/fix-7263
2 parents d323b76 + 5bfbc87 commit 0ad2f3c

File tree

13 files changed

+140
-70
lines changed

13 files changed

+140
-70
lines changed

CHANGELOG.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,13 @@ All notable changes for each version of this project will be documented in this
154154
- Added functionality for displaying various content into the toast component. It also allows users to access toast styles through its host element.
155155

156156
- `IgxDrag`
157-
- New `igxDragIgnore` directive that allows children of the `igxDrag` element to be interactable and receive mouse events. Dragging cannot be performed from those elements that are ignored.
158-
- New `dragDirection` input that can specify only one direction of dragging or both.
157+
- Added `igxDragIgnore` directive that allows children of the `igxDrag` element to be interactable and receive mouse events. Dragging cannot be performed from those elements that are ignored.
158+
- Added `dragDirection` input that can specify only one direction of dragging or both.
159+
160+
- `IgxChip`
161+
- Added support for tabIndex attribute applied to the main chip element.
162+
- Added `tabIndex` input so it can support change detection as well.
163+
159164

160165
### RTL Support
161166
- `igxSlider` have full right-to-left (RTL) support.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ This product is free to use for non-commercial applications, like non-profits an
55
To acquire a license for commercial usage,
66
please register for a trial and acquire a license at https://Infragistics.com/Angular.
77

8-
© Copyright 2018 INFRAGISTICS. All Rights Reserved.
8+
© Copyright 2020 INFRAGISTICS. All Rights Reserved.
99
The Infragistics Ultimate license & copyright applies to this distribution.
1010
For information on that license, please go to our website https://www.infragistics.com/legal/license.

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ pool:
22
vmImage: 'Ubuntu 16.04'
33

44
steps:
5-
- script: npm install
5+
- script: npm ci
66
displayName: 'Install dependencies'
77
env:
88
AZURE_PIPELINES: "true"

projects/igniteui-angular/src/lib/chips/chip.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div #chipArea class="igx-chip__item"
2-
[attr.tabindex]="chipTabindex"
2+
[attr.tabIndex]="tabIndex"
33
(keydown)="onChipKeyDown($event)"
44
[igxDrag]="{chip: this}"
55
[style.visibility]='hideBaseElement ? "hidden" : "visible"'
@@ -27,7 +27,7 @@
2727
<ng-content select="igx-suffix,[igxSuffix]"></ng-content>
2828

2929
<div class="igx-chip__remove" *ngIf="removable"
30-
tabindex="0"
30+
[attr.tabIndex]="tabIndex"
3131
(keydown)="onRemoveBtnKeyDown($event)"
3232
(pointerdown)="onRemoveMouseDown($event)"
3333
(mousedown)="onRemoveMouseDown($event)"

projects/igniteui-angular/src/lib/chips/chip.component.ts

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,25 @@ export class IgxChipComponent extends DisplayDensityBase {
9090
@Input()
9191
public id = `igx-chip-${CHIP_ID++}`;
9292

93+
/**
94+
* An @Input property that sets the value of `tabindex` attribute. If not provided it will use the element's tabindex if set.
95+
* @example
96+
* ```html
97+
* <igx-chip [id]="'igx-chip-1'" [tabIndex]="1"></igx-chip>
98+
* ```
99+
*/
100+
@Input()
101+
public set tabIndex(value: number) {
102+
this._tabIndex = value;
103+
}
104+
105+
public get tabIndex() {
106+
if (this._tabIndex !== null) {
107+
return this._tabIndex;
108+
}
109+
return !this.disabled ? 0 : null;
110+
}
111+
93112
/**
94113
* An @Input property that stores data related to the chip.
95114
* @example
@@ -353,6 +372,13 @@ export class IgxChipComponent extends DisplayDensityBase {
353372
@Output()
354373
public onDragEnter = new EventEmitter<IChipEnterDragAreaEventArgs>();
355374

375+
/**
376+
* @hidden
377+
* @internal
378+
*/
379+
@HostBinding('attr.tabIndex')
380+
public hostTabIndex = null;
381+
356382
/**
357383
* @hidden
358384
* @internal
@@ -433,16 +459,13 @@ export class IgxChipComponent extends DisplayDensityBase {
433459
return this.getComponentDensityClass('igx-chip__ghost');
434460
}
435461

436-
public get chipTabindex() {
437-
return !this.disabled ? 0 : '';
438-
}
439-
440462
/**
441463
* @hidden
442464
* @internal
443465
*/
444466
public hideBaseElement = false;
445467

468+
protected _tabIndex = null;
446469
protected _selected = false;
447470
protected _selectedItemClass = 'igx-chip__item--selected';
448471
protected _movedWhileRemoving = false;

projects/igniteui-angular/src/lib/chips/chip.spec.ts

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,21 @@ import { ControlsFunction } from '../test-utils/controls-functions.spec';
2727
<span #label [class]="'igx-chip__text'">{{chip.text}}</span>
2828
<igx-icon igxPrefix fontSet="material">drag_indicator</igx-icon>
2929
</igx-chip>
30+
<igx-chip #chipElem tabIndex="1" [id]="tabChipAttr">
31+
<span #label [class]="'igx-chip__text'">Tab Chip</span>
32+
</igx-chip>
33+
<igx-chip #chipElem tabIndex="2" [disabled]="true" [id]="tabChipDisabled">
34+
<span #label [class]="'igx-chip__text'">Tab Chip</span>
35+
</igx-chip>
36+
<igx-chip #chipElem [tabIndex]="3" [removable]="true" [id]="tabChipInput" >
37+
<span #label [class]="'igx-chip__text'">Tab Chip</span>
38+
</igx-chip>
39+
<igx-chip #chipElem tabIndex="4" [tabIndex]="1" [id]="tabChipBoth">
40+
<span #label [class]="'igx-chip__text'">Tab Chip</span>
41+
</igx-chip>
42+
<igx-chip #chipElem tabIndex="5" [tabIndex]="1" [disabled]="true" [id]="tabChipAll">
43+
<span #label [class]="'igx-chip__text'">Tab Chip</span>
44+
</igx-chip>
3045
</igx-chips-area>
3146
`
3247
})
@@ -114,7 +129,7 @@ describe('IgxChip', () => {
114129

115130
it('should render chip area and chips inside it', () => {
116131
expect(chipArea.length).toEqual(1);
117-
expect(chipArea[0].nativeElement.children.length).toEqual(4);
132+
expect(chipArea[0].nativeElement.children.length).toEqual(9);
118133
expect(chipArea[0].nativeElement.children[0].tagName).toEqual('IGX-CHIP');
119134
});
120135

@@ -169,7 +184,7 @@ describe('IgxChip', () => {
169184
// Assert default css class is applied
170185
const comfortableComponents = fix.debugElement.queryAll(By.css(CHIP_CLASS));
171186

172-
expect(comfortableComponents.length).toEqual(2);
187+
expect(comfortableComponents.length).toEqual(7);
173188
expect(comfortableComponents[0].nativeElement).toBe(firstComponent.nativeElement);
174189
expect(comfortableComponents[1].nativeElement).toBe(secondComponent.nativeElement);
175190
});
@@ -212,6 +227,35 @@ describe('IgxChip', () => {
212227
expect(chipAreaElem.nativeElement.style.backgroundColor).toEqual(chipColor);
213228
expect(firstComponent.componentInstance.color).toEqual(chipColor);
214229
});
230+
231+
it('should apply correct tabIndex to the chip area only when tabIndex is set as property of the chip and chip is disabled', () => {
232+
const firstTabChip = fix.debugElement.queryAll(By.directive(IgxChipComponent))[4];
233+
expect(firstTabChip.nativeElement.getAttribute('tabindex')).toBeFalsy();
234+
expect(firstTabChip.componentInstance.chipArea.nativeElement.getAttribute('tabindex')).toEqual('1');
235+
236+
// Chip is disabled, but attribute tabindex has bigger priority.
237+
const secondTabChip = fix.debugElement.queryAll(By.directive(IgxChipComponent))[5];
238+
expect(secondTabChip.nativeElement.getAttribute('tabindex')).toBeFalsy();
239+
expect(secondTabChip.componentInstance.chipArea.nativeElement.getAttribute('tabindex')).toEqual('2');
240+
});
241+
242+
it('should apply correct tab indexes when tabIndex and removeTabIndex are set as inputs', () => {
243+
const thirdTabChip = fix.debugElement.queryAll(By.directive(IgxChipComponent))[6];
244+
const deleteBtn = ControlsFunction.getChipRemoveButton(thirdTabChip.componentInstance.chipArea.nativeElement);
245+
expect(thirdTabChip.nativeElement.getAttribute('tabindex')).toBeFalsy();
246+
expect(thirdTabChip.componentInstance.chipArea.nativeElement.getAttribute('tabindex')).toEqual('3');
247+
expect(deleteBtn.getAttribute('tabindex')).toEqual('3');
248+
249+
// tabIndex attribute has higher priority than tabIndex.
250+
const fourthTabChip = fix.debugElement.queryAll(By.directive(IgxChipComponent))[7];
251+
expect(fourthTabChip.nativeElement.getAttribute('tabindex')).toBeFalsy();
252+
expect(fourthTabChip.componentInstance.chipArea.nativeElement.getAttribute('tabindex')).toEqual('1');
253+
254+
// tabIndex attribute has higher priority than tabIndex input and chip being disabled.
255+
const fifthTabChip = fix.debugElement.queryAll(By.directive(IgxChipComponent))[8];
256+
expect(fifthTabChip.nativeElement.getAttribute('tabindex')).toBeFalsy();
257+
expect(fifthTabChip.componentInstance.chipArea.nativeElement.getAttribute('tabindex')).toEqual('1');
258+
});
215259
});
216260

217261
describe('Interactions Tests: ', () => {
@@ -241,30 +285,30 @@ describe('IgxChip', () => {
241285
});
242286

243287
it('should delete chip when space button is pressed on delete button', () => {
244-
HelperTestFunctions.verifyChipsCount(fix, 4);
288+
HelperTestFunctions.verifyChipsCount(fix, 9);
245289
const chipElems = fix.debugElement.queryAll(By.directive(IgxChipComponent));
246290
const deleteButtonElement = ControlsFunction.getChipRemoveButton(chipElems[1].nativeElement);
247291
// Removes chip with id City, because country chip is unremovable
248292
UIInteractions.triggerKeyDownEvtUponElem(' ', deleteButtonElement, true);
249293
fix.detectChanges();
250294

251-
HelperTestFunctions.verifyChipsCount(fix, 3);
295+
HelperTestFunctions.verifyChipsCount(fix, 8);
252296

253297
const chipComponentsIds = fix.componentInstance.chipList.map(c => c.id);
254298
expect(chipComponentsIds.length).toEqual(3);
255299
expect(chipComponentsIds).not.toContain('City');
256300
});
257301

258302
it('should delete chip when enter button is pressed on delete button', () => {
259-
HelperTestFunctions.verifyChipsCount(fix, 4);
303+
HelperTestFunctions.verifyChipsCount(fix, 9);
260304

261305
const chipElems = fix.debugElement.queryAll(By.directive(IgxChipComponent));
262306
const deleteButtonElement = ControlsFunction.getChipRemoveButton(chipElems[1].nativeElement);
263307
// Removes chip with id City, because country chip is unremovable
264308
UIInteractions.triggerKeyDownEvtUponElem('Enter', deleteButtonElement, true);
265309
fix.detectChanges();
266310

267-
HelperTestFunctions.verifyChipsCount(fix, 3);
311+
HelperTestFunctions.verifyChipsCount(fix, 8);
268312

269313
const chipComponentsIds = fix.componentInstance.chipList.map(c => c.id);
270314
expect(chipComponentsIds.length).toEqual(3);

projects/igniteui-angular/src/lib/core/styles/components/icon/_icon-theme.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@
5555
@mixin igx-icon($theme) {
5656
@include igx-root-css-vars($theme);
5757

58-
// @debug $theme;
59-
6058
$igx-icon-font-size: --var($theme, 'size');
6159

6260
%igx-icon-display {

projects/igniteui-angular/src/lib/core/styles/themes/schemas/light/_action-strip.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
///
88
/// Generates a light action-strip schema.
99
/// @type {Map}
10-
/// @prop {Color} $color [currentColor] - The color used for the actions icons.
10+
/// @prop {Color} $color ["'currentColor'"] - The color used for the actions icons.
1111
/// @prop {Map} background [igx-color: ('grays', 100] - The color used for the action strip component content background.
1212
/// @prop {Map} actions-background [igx-color: ('grays', 200), hexrgba: #fff, rgba: .9] - The color used for actions background.
1313
/// @prop {Map} delete-action [igx-color: ('error')] - The color used for the delete icon in action strip component.
@@ -28,7 +28,7 @@ $_light-action-strip: extend(
2828
igx-color: ('grays', 100)
2929
),
3030

31-
color: currentColor,
31+
color: "'currentColor'",
3232

3333
delete-action: (
3434
igx-color: ('error')

projects/igniteui-angular/src/lib/core/styles/themes/schemas/light/_button.scss

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
/// @prop {Map} flat-hover-text-color [igx-color: ('secondary', 500)] - The hover text color of a flat button.
1717
/// @prop {Map} flat-focus-background [igx-color: ('secondary', 400), rgba: .12] - The focus background color of a flat button.
1818
/// @prop {Map} flat-focus-text-color [igx-color: ('secondary', 500)] - The focus text color of a flat button.
19-
/// @prop {Color} flat-icon-color [currentColor] - The color of a flat button icon.
20-
/// @prop {Color} flat-hover-icon-color [currentColor] - The hover color of a flat button icon.
21-
/// @prop {Color} flat-focus-icon-color [currentColor] - The focus color of a flat button icon.
19+
/// @prop {Color} flat-icon-color ["'currentColor'"] - The color of a flat button icon.
20+
/// @prop {Color} flat-hover-icon-color ["'currentColor'"] - The hover color of a flat button icon.
21+
/// @prop {Color} flat-focus-icon-color ["'currentColor'"] - The focus color of a flat button icon.
2222
///
2323
/// @prop {Color} outlined-background [transparent] - The background color of an outlined button
2424
/// @prop {Map} outlined-text-color [igx-color: ('secondary', 500)] - The idle text color of an outlined button.
@@ -28,19 +28,19 @@
2828
/// @prop {Map} outlined-hover-text-color [igx-color: ('secondary', 500)] - The hover text color of an outlined button.
2929
/// @prop {Map} outlined-focus-background [igx-color: ('secondary', 400), rgba: .12] - The focus background color of an outlined button.
3030
/// @prop {Map} outlined-focus-text-color [igx-color: ('secondary', 500)] - The focus text color of an outlined button.
31-
/// @prop {Color} outlined-icon-color [currentColor] - The color of a outlined button icon.
32-
/// @prop {Color} outlined-hover-icon-color [currentColor] - The hover color of a outlined button icon.
33-
/// @prop {Color} outlined-focus-icon-color [currentColor] - The focus color of a outlined button icon.
31+
/// @prop {Color} outlined-icon-color ["'currentColor'"] - The color of a outlined button icon.
32+
/// @prop {Color} outlined-hover-icon-color ["'currentColor'"] - The hover color of a outlined button icon.
33+
/// @prop {Color} outlined-focus-icon-color ["'currentColor'"] - The focus color of a outlined button icon.
3434
///
3535
/// @prop {Map} raised-background [igx-color: ('secondary', 500)] - The background color of an raised button.
3636
/// @prop {Map} raised-text-color [igx-contrast-color: ('secondary', 500)] - The idle text color of a raised button.
3737
/// @prop {Map} raised-hover-background [igx-color: ('secondary', 300)] - The hover background of a raised button.
3838
/// @prop {Map} raised-hover-text-color [igx-contrast-color: ('secondary', 300)] - The hover text color of a raised button.
3939
/// @prop {Map} raised-focus-background [igx-color: ('secondary', 300)] - The focus background color of a raised button.
4040
/// @prop {Map} raised-focus-text-color [igx-contrast-color: ('secondary', 300)] - The focus text color of a raised button.
41-
/// @prop {Color} raised-icon-color [currentColor] - The color of a raised button icon.
42-
/// @prop {Color} raised-hover-icon-color [currentColor] - The hover color of a raised button icon.
43-
/// @prop {Color} raised-focus-icon-color [currentColor] - The focus color of a raised button icon.
41+
/// @prop {Color} raised-icon-color ["'currentColor'"] - The color of a raised button icon.
42+
/// @prop {Color} raised-hover-icon-color ["'currentColor'"] - The hover color of a raised button icon.
43+
/// @prop {Color} raised-focus-icon-color ["'currentColor'"] - The focus color of a raised button icon.
4444
///
4545
/// @prop {Map} fab-background [igx-color: ('secondary', 500)] - The background color of a floating action button.
4646
/// @prop {Map} fab-text-color [igx-contrast-color: ('secondary', 500)] - The text color of a floating action button.
@@ -86,17 +86,17 @@ $_light-button: extend(
8686
igx-color: ('secondary', 500)
8787
),
8888

89-
flat-icon-color: currentColor,
90-
flat-hover-icon-color: currentColor,
91-
flat-focus-icon-color: currentColor,
89+
flat-icon-color: "'currentColor'",
90+
flat-hover-icon-color: "'currentColor'",
91+
flat-focus-icon-color: "'currentColor'",
9292

93-
raised-icon-color: currentColor,
94-
raised-hover-icon-color: currentColor,
95-
raised-focus-icon-color: currentColor,
93+
raised-icon-color: "'currentColor'",
94+
raised-hover-icon-color: "'currentColor'",
95+
raised-focus-icon-color: "'currentColor'",
9696

97-
outlined-icon-color: currentColor,
98-
outlined-hover-icon-color: currentColor,
99-
outlined-focus-icon-color: currentColor,
97+
outlined-icon-color: "'currentColor'",
98+
outlined-hover-icon-color: "'currentColor'",
99+
outlined-focus-icon-color: "'currentColor'",
100100

101101
flat-hover-background: (
102102
igx-color: ('secondary', 500),

projects/igniteui-angular/src/lib/core/styles/themes/schemas/light/_chip.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
/// @prop {Map} focus-selected-background [igx-color: ('grays', 400)] - The selected chip focus background color.
3131
/// @prop {Color} focus-selected-border-color [transparent] - The selected chip focus border color.
3232
/// @prop {Number} ghost-elevation [8] - The elevation level for the chip's ghost (dragging mode). Between 0-24.
33-
/// @prop {color} remove-icon-color [currentColor] - The remove icon color for the chip.
33+
/// @prop {color} remove-icon-color ["'currentColor'"] - The remove icon color for the chip.
3434
/// @prop {Map} remove-icon-color-focus [igx-color: ('error')] - The remove icon color on focus for the chip.
3535
/// @prop {color} $focus-border-color [transparent] - The chip focus border color.
3636
///
@@ -44,7 +44,7 @@ $_light-chip: extend(
4444
(
4545
variant:'material',
4646

47-
remove-icon-color: currentColor,
47+
remove-icon-color: "'currentColor'",
4848

4949
remove-icon-color-focus: (
5050
igx-color: ('error')

0 commit comments

Comments
 (0)