Skip to content

Commit

Permalink
Merge pull request #3064 from preactjs/ie11-tabindex
Browse files Browse the repository at this point in the history
Fix tabIndex not getting reset in IE11
  • Loading branch information
marvinhagemeister committed Mar 14, 2021
2 parents cd8d658 + 04b06e8 commit f053897
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/browser/render.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1145,18 +1145,20 @@ describe('render()', () => {

// #3060
it('should reset tabindex on undefined/null', () => {
const defaultValue = isIE11 ? 0 : -1;

render(<div tabIndex={0} />, scratch);
expect(scratch.firstChild.tabIndex).to.equal(0);
render(<div tabIndex={undefined} />, scratch);
expect(scratch.firstChild.tabIndex).to.equal(-1);
expect(scratch.firstChild.tabIndex).to.equal(defaultValue);
render(<div tabIndex={null} />, scratch);
expect(scratch.firstChild.tabIndex).to.equal(-1);
expect(scratch.firstChild.tabIndex).to.equal(defaultValue);

render(<div tabindex={0} />, scratch);
expect(scratch.firstChild.tabIndex).to.equal(0);
render(<div tabindex={undefined} />, scratch);
expect(scratch.firstChild.tabIndex).to.equal(-1);
expect(scratch.firstChild.tabIndex).to.equal(defaultValue);
render(<div tabindex={null} />, scratch);
expect(scratch.firstChild.tabIndex).to.equal(-1);
expect(scratch.firstChild.tabIndex).to.equal(defaultValue);
});
});

0 comments on commit f053897

Please sign in to comment.