Fix tabindex for gr-button
Bug: Issue 11969 Change-Id: Ice7519764a2cbf86cfd8b5067060faa6d0dee472
This commit is contained in:
parent
5bb7c0277a
commit
0c9ddd97b9
@ -91,7 +91,7 @@
|
||||
|
||||
_disabledChanged(disabled) {
|
||||
if (disabled) {
|
||||
this._enabledTabindex = this.getAttribute('tabindex');
|
||||
this._enabledTabindex = this.getAttribute('tabindex') || '0';
|
||||
}
|
||||
this.setAttribute('tabindex', disabled ? '-1' : this._enabledTabindex);
|
||||
this.updateStyles();
|
||||
|
@ -68,6 +68,21 @@ limitations under the License.
|
||||
assert.isTrue(element.$$('paper-button').disabled);
|
||||
});
|
||||
|
||||
test('tabindex should be -1 if disabled', () => {
|
||||
element.disabled = true;
|
||||
assert.isTrue(element.getAttribute('tabindex') === '-1');
|
||||
});
|
||||
|
||||
// Regression tests for Issue: 11969
|
||||
test('tabindex should be reset to 0 if enabled', () => {
|
||||
element.disabled = false;
|
||||
assert.isTrue(element.getAttribute('tabindex') === '0');
|
||||
element.disabled = true;
|
||||
assert.isTrue(element.getAttribute('tabindex') === '-1');
|
||||
element.disabled = false;
|
||||
assert.isTrue(element.getAttribute('tabindex') === '0');
|
||||
});
|
||||
|
||||
// 'tap' event is tested so we don't loose backward compatibility with older
|
||||
// plugins who didn't move to on-click which is faster and well supported.
|
||||
for (const eventName of ['tap', 'click']) {
|
||||
|
Loading…
Reference in New Issue
Block a user