Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nzselect): 为nz-select添加tabindex属性 #2574

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions components/select/doc/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Select component to select value from options.
| `[nzNotFoundContent]` | Specify content to show when no result matches.. | string | 'Not Found' |
| `[nzPlaceHolder]` | Placeholder of select | string | - |
| `[nzShowSearch]` | Whether show search input in single mode. | boolean | false |
| `[tabindex]` | make nz-select can be set tabindex attr | number | 1 |
| `[nzSize]` | Size of Select input. `default` `large` `small` | string | default |
| `(ngModelChange)` | Current selected nz-option value change callback. | `EventEmitter<any[]>` | - |
| `(nzOpenChange)` | dropdown expand change callback | `EventEmitter<boolean>` | false |
Expand Down
1 change: 1 addition & 0 deletions components/select/doc/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ title: Select
| `[nzNotFoundContent]` | 当下拉列表为空时显示的内容 | string | - |
| `[nzPlaceHolder]` | 选择框默认文字 | string | - |
| `[nzShowSearch]` | 使单选模式可搜索 | boolean | false |
| `[tabindex]` | 使select可以设置tabindex | number | 1 |
| `[nzSize]` | 选择框大小,可选 `large` `small` | string | default |
| `(ngModelChange)` | 选中的 nz-option 发生变化时,调用此函数 | `EventEmitter<any[]>` | - |
| `(nzOpenChange)` | 下拉菜单打开状态变化回调 | `EventEmitter<boolean>` | - |
Expand Down
1 change: 1 addition & 0 deletions components/select/nz-select-top-control.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
(input)="updateWidth()"
(keydown)="onKeyDownInput($event)"
[ngModel]="inputValue"
[tabindex]="tabindex"
(ngModelChange)="setInputValue($event,true)"
[disabled]="nzDisabled">
</ng-template>
Expand Down
2 changes: 1 addition & 1 deletion components/select/nz-select-top-control.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class NzSelectTopControlComponent {
@Input() nzOpen = false;
// tslint:disable-next-line:no-any
@Input() compareWith: (o1: any, o2: any) => boolean;

@Input() tabindex = 1;
@Input()
// tslint:disable-next-line:no-any
set nzListOfSelectedValue(value: any[]) {
Expand Down
1 change: 1 addition & 0 deletions components/select/nz-select.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
[nzMode]="nzMode"
[nzListTemplateOfOption]="listOfTemplateOption"
[nzListOfSelectedValue]="listOfSelectedValue"
[tabindex]="tabindex"
(nzOnSearch)="onSearch($event.value,$event.emit)"
(nzListOfSelectedValueChange)="updateListOfSelectedValueFromTopControl($event)">
</div>
Expand Down
1 change: 1 addition & 0 deletions components/select/nz-select.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ export class NzSelectComponent implements ControlValueAccessor, OnInit, AfterVie
/** https://github.com/angular/angular/pull/13349/files **/
// tslint:disable-next-line:no-any
@Input() compareWith = (o1: any, o2: any) => o1 === o2;
@Input() tabindex = 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

The default value of tabindex attribute in HTML Living Standard is 0 and I think we should align with that.

Also note that it is not recommended to use positive tabindex in most cases.

Copy link
Author

Choose a reason for hiding this comment

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

yes,the default value shoud be 0,but sometimes it is necessary to skip it.


@Input()
set nzDropdownClassName(value: string) {
Expand Down