Skip to content

Commit 211d84d

Browse files
authored
Merge pull request #2250 from Akshat55/select-access
fix: Add associated label to 'select' element
2 parents 7819d90 + 12f23de commit 211d84d

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/i18n/en.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ export default {
129129
"OF_LAST_PAGES": "of {{last}} pages",
130130
"OF_LAST_PAGE": "of {{last}} page",
131131
"NEXT": "Next",
132-
"PREVIOUS": "Previous"
132+
"PREVIOUS": "Previous",
133+
"SELECT_ARIA": "Select page number"
133134
},
134135
"TABLE": {
135136
"GO_TO_PAGE": "Go to page",

src/pagination/pagination-nav/pagination-overflow.component.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import {
44
Output,
55
EventEmitter
66
} from "@angular/core";
7+
import { I18n } from "carbon-components-angular/i18n";
8+
79
/**
810
* Used to present a selection of pages when there is an overflow
911
* in the pagination list
@@ -18,7 +20,9 @@ import {
1820
<li class="bx--pagination-nav__list-item" *ngIf="count > 1">
1921
<div class="bx--pagination-nav__select">
2022
<select
21-
class="bx--pagination-nav__page bx--pagination-nav__page--select" (change)="handleChange($event)">
23+
[attr.aria-label]="ariaLabel"
24+
class="bx--pagination-nav__page bx--pagination-nav__page--select"
25+
(change)="handleChange($event)">
2226
<option value="" hidden></option>
2327
<option
2428
*ngFor="let item of countAsArray; let i = index">
@@ -46,6 +50,8 @@ export class PaginationOverflow {
4650

4751
@Input() count: number;
4852

53+
@Input() ariaLabel: string = this.i18n.get().PAGINATION.SELECT_ARIA;
54+
4955
/**
5056
* Emits click event
5157
*/
@@ -55,7 +61,7 @@ export class PaginationOverflow {
5561
return [...Array(this.count)];
5662
}
5763

58-
constructor() {}
64+
constructor(protected i18n: I18n) {}
5965

6066
handleChange(event) {
6167
this.change.emit(+event.target.value);

0 commit comments

Comments
 (0)