Skip to content

Commit

Permalink
Add aria-disabled element to previous and next buttons (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
geramirez authored and paranoidjk committed May 17, 2017
1 parent 3e21cc8 commit b482418
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Pagination.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ class Pagination extends React.Component {
title={props.showTitle ? locale.prev_page : null}
onClick={this._prev}
className={`${this._hasPrev() ? '' : `${prefixCls}-disabled`} ${prefixCls}-prev`}
aria-disabled={!this._hasPrev()}
>
<a />
</li>
Expand All @@ -233,6 +234,7 @@ class Pagination extends React.Component {
title={props.showTitle ? locale.next_page : null}
onClick={this._next}
className={`${this._hasNext() ? '' : `${prefixCls}-disabled`} ${prefixCls}-next`}
aria-disabled={!this._hasNext()}
>
<a />
</li>
Expand Down Expand Up @@ -376,6 +378,7 @@ class Pagination extends React.Component {
title={props.showTitle ? locale.prev_page : null}
onClick={this._prev}
className={`${this._hasPrev() ? '' : `${prefixCls}-disabled`} ${prefixCls}-prev`}
aria-disabled={!this._hasPrev()}
>
<a />
</li>
Expand All @@ -384,6 +387,7 @@ class Pagination extends React.Component {
title={props.showTitle ? locale.next_page : null}
onClick={this._next}
className={`${this._hasNext() ? '' : `${prefixCls}-disabled`} ${prefixCls}-next`}
aria-disabled={!this._hasNext()}
>
<a />
</li>
Expand Down
2 changes: 2 additions & 0 deletions tests/Pagination.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ describe('Uncontrolled Pagination', () => {
);
expect(TestUtils.isDOMComponent(prevButton)).to.be(true);
expect(prevButton.className).to.contain('rc-pagination-disabled');
expect(prevButton.getAttribute('aria-disabled')).to.equal('true');
});

it('should hightlight current page and not highlight other page', shouldHighlightRight);
Expand All @@ -83,6 +84,7 @@ describe('Uncontrolled Pagination', () => {

expect(TestUtils.isDOMComponent(nextButton)).to.be(true);
expect(nextButton.className).to.not.contain('rc-pagination-disabled');
expect(nextButton.getAttribute('aria-disabled')).to.equal('false');
});

it('should response mouse click right', (done) => {
Expand Down

0 comments on commit b482418

Please sign in to comment.