Skip to content

Commit

Permalink
[changed] PaginationButton to use SafeAnchor
Browse files Browse the repository at this point in the history
Using the `SafeAnchor` for better accessibility.

Per #786 commitcomment-11527424
Resolves #788
  • Loading branch information
mtscout6 committed Jun 9, 2015
1 parent d3c2eca commit beaa1fa
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/PaginationButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import classNames from 'classnames';
import BootstrapMixin from './BootstrapMixin';
import createSelectedEvent from './utils/createSelectedEvent';
import SafeAnchor from './SafeAnchor';

const PaginationButton = React.createClass({
mixins: [BootstrapMixin],
Expand All @@ -25,24 +26,29 @@ const PaginationButton = React.createClass({
},

handleClick(event) {
// This would go away once SafeAnchor is available
event.preventDefault();

if (this.props.onSelect) {
let selectedEvent = createSelectedEvent(this.props.eventKey);
this.props.onSelect(event, selectedEvent);
}
},

render() {
let classes = this.getBsClassSet();
let classes = {
active: this.props.active,
disabled: this.props.disabled,
...this.getBsClassSet()
};

classes.active = this.props.active;
classes.disabled = this.props.disabled;
let {
className,
...anchorProps // eslint-disable-line object-shorthand
} = this.props;

return (
<li className={classNames(this.props.className, classes)}>
<a href='#' onClick={this.handleClick}>{this.props.children}</a>
<li className={classNames(className, classes)}>
<SafeAnchor
{...anchorProps}
onClick={this.handleClick} />
</li>
);
}
Expand Down

0 comments on commit beaa1fa

Please sign in to comment.