Skip to content

No way to set tabindex of material buttons #12041

@Sixthdim

Description

@Sixthdim

Bug, feature request, or proposal:

It appears there is no way to set the tabindex attribute on Angular Material buttons due to this bit of code: https://github.com/angular/material2/blob/6.3.x/src/lib/button/button.ts#L152

What is the expected behavior?

Setting the tabindex attribute on an Angular Material button with tabindex="3" or [attr.tabindex]="myTabIndex" should stick.

What is the current behavior?

The tabindex attribute is overridden by the Angular Material button component to be "-1" if disabled or "0" if not disabled.

What are the steps to reproduce?

Add the tabindex attribute to an Angular Material button and observe it is not preserved.

What is the use-case or motivation for changing an existing behavior?

I have a list of buttons where the order can be dynamically configured. The order is handled by the FlexLayout "fxFlexOrder" directive which effectively changes the tabbing order. Being able to set the tabindex to the same flex order value would resolve my tabbing issue.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

All

Is there anything else we should know?

Nope.

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions