Skip to content

Commit 26e1034

Browse files
authored
Merge pull request #341 from UiPath/fix/suggest_a11y
Fix(suggest-a11y): add aria-label input
2 parents 63e160d + b36faad commit 26e1034

File tree

7 files changed

+43
-8
lines changed

7 files changed

+43
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# v13.7.9 (2023-05-11)
2+
* **suggest** add input for aria-label
3+
* **suggest** condition title display by input
4+
15
# v13.7.8 (2023-05-10)
26
* **fix** display outline on suggest grid filter
37

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-components",
3-
"version": "13.7.8",
3+
"version": "13.7.9",
44
"author": {
55
"name": "UiPath Inc",
66
"url": "https://uipath.com"

projects/angular/components/ui-suggest/src/ui-suggest.component.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
[uiAutofocus]="!isOpen && focus"
1717
[refocus]="!isOpen && focus"
1818
[matRippleDisabled]="isFormControl"
19-
[attr.aria-label]="placeholder"
19+
[attr.aria-label]="ariaLabel ?? placeholder"
2020
[attr.aria-describedby]="describedBy"
2121
[attr.aria-required]="required"
2222
[attr.aria-disabled]="disabled || readonly"
@@ -44,7 +44,7 @@
4444
<ng-template #showDefaultValue>
4545
<div [matTooltip]="tooltip ?? ''"
4646
class="display-container text-ellipsis">
47-
<span *ngIf="!isFormControl && placeholder"
47+
<span *ngIf="!isFormControl && placeholder && !shouldHideTitle"
4848
class="display-title"
4949
aria-hidden="true">
5050
{{ placeholder }}:
@@ -74,7 +74,7 @@
7474
<ng-template #chipsTemplate>
7575
<mat-chip-list #chipList
7676
[attr.tabindex]="!disabled && !readonly ? 0 : null"
77-
[attr.aria-label]="placeholder"
77+
[attr.aria-label]="ariaLabel ?? placeholder"
7878
[attr.aria-describedby]="describedBy"
7979
[attr.aria-required]="required"
8080
[attr.aria-disabled]="disabled || readonly"
@@ -116,7 +116,7 @@
116116
[formControl]="inputControl"
117117
[matChipInputFor]="chipList"
118118
[attr.maxlength]="maxLength"
119-
[attr.aria-label]="placeholder"
119+
[attr.aria-label]="ariaLabel ?? placeholder"
120120
selectionLocation="end"
121121
autocomplete="off"
122122
aria-autocomplete="list"

projects/angular/components/ui-suggest/src/ui-suggest.component.spec.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ class UiSuggestFixtureDirective {
8989
displayPriority: 'default' | 'selected' = 'default';
9090
fetchStrategy: 'eager' | 'onOpen' = 'eager';
9191
minChars = 0;
92+
shouldHideTitle = false;
9293

9394
set value(value: ISuggestValue[] | undefined) {
9495
this._value = value;
@@ -148,6 +149,21 @@ const sharedSpecifications = (
148149
});
149150

150151
describe('Behavior: standard usage', () => {
152+
([true, false].forEach(shouldHideTitle => {
153+
it(`should ${shouldHideTitle ? 'not' : ''} display title if shouldHideTitle is ${shouldHideTitle}`, () => {
154+
component.placeholder = 'some place holder';
155+
component.shouldHideTitle = shouldHideTitle;
156+
157+
fixture.detectChanges();
158+
const spanElem = document.querySelector('.display-title');
159+
if (shouldHideTitle || uiSuggest.isFormControl) {
160+
expect(spanElem).toBeNull();
161+
} else {
162+
expect(spanElem).toBeTruthy();
163+
}
164+
});
165+
}));
166+
151167
it('should be initialized', () => {
152168
expect(uiSuggest).toBeDefined();
153169
});
@@ -2464,7 +2480,8 @@ describe('Component: UiSuggest', () => {
24642480
[minChars]="minChars"
24652481
[drillDown]="drillDown"
24662482
[readonly]="readonly"
2467-
[compact]="compact">
2483+
[compact]="compact"
2484+
[shouldHideTitle]="shouldHideTitle">
24682485
</ui-suggest>
24692486
`,
24702487
})

projects/angular/components/ui-suggest/src/ui-suggest.mat-form-field.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,20 @@ export abstract class UiSuggestMatFormFieldDirective implements
103103
this.stateChanges.next();
104104
}
105105

106+
/**
107+
* Hides the combo box title.
108+
*
109+
*/
110+
@Input()
111+
shouldHideTitle = false;
112+
113+
/**
114+
* Sets aria-label on input or mat-chip-list element.
115+
*
116+
*/
117+
@Input('aria-label')
118+
ariaLabel: string | null = null;
119+
106120
/**
107121
* Set a custom size for the list items.
108122
*

projects/angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@uipath/angular",
3-
"version": "13.7.8",
3+
"version": "13.7.9",
44
"license": "MIT",
55
"author": {
66
"name": "UiPath Inc",

0 commit comments

Comments
 (0)