Skip to content

Commit 16b99a1

Browse files
Merge pull request Hacker0x01#202 from rafeememon/bugfix/fix-clear-button-nav
Prevent page nav when clicking clear button
2 parents 05be382 + dec8751 commit 16b99a1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/datepicker.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ var DatePicker = React.createClass( {
115115
} );
116116
},
117117

118+
onClearClick: function( event ) {
119+
event.preventDefault();
120+
this.clearSelected();
121+
},
122+
118123
calendar: function() {
119124
if ( this.state.focus ) {
120125
return (
@@ -145,7 +150,7 @@ var DatePicker = React.createClass( {
145150
var clearButton = null;
146151
if ( this.props.isClearable && this.state.selected != null ) {
147152
clearButton = (
148-
<a className="close-icon" href="#" onClick={this.clearSelected}></a>
153+
<a className="close-icon" href="#" onClick={this.onClearClick}></a>
149154
);
150155
}
151156

0 commit comments

Comments
 (0)