Skip to content

Commit

Permalink
[fixed] buttons submitting forms
Browse files Browse the repository at this point in the history
  • Loading branch information
jquense committed Jul 12, 2016
1 parent 9b18be4 commit 8409875
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
12 changes: 10 additions & 2 deletions src/WidgetButton.jsx → src/Button.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import cn from 'classnames';

export default React.createClass({
class Button extends React.Component {

render() {
let {
Expand All @@ -15,11 +15,17 @@ export default React.createClass({
, component: Tag = 'button'
, ...props } = this.props;

let type = props.type;

if (Tag === 'button')
type = type || 'button';

return (
<Tag
{...props}
tabIndex="-1"
title={label}
type={type}
disabled={disabled}
aria-disabled={disabled}
aria-label={label}
Expand All @@ -43,4 +49,6 @@ export default React.createClass({
</Tag>
)
}
})
}

export default Button;
2 changes: 1 addition & 1 deletion src/DateTimePicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import Popup from './Popup';
import BaseCalendar from './Calendar';
import TimeList from './TimeList';
import DateTimePickerInput from './DateTimePickerInput';
import Button from './WidgetButton';
import Button from './Button';
import CustomPropTypes from './util/propTypes';
import createUncontrolledWidget from 'uncontrollable';
import { widgetEditable } from './util/interaction';
Expand Down
2 changes: 1 addition & 1 deletion src/Footer.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import Button from './WidgetButton';
import Button from './Button';
import { date as dateLocalizer } from './util/localizers';

var format = props => dateLocalizer.getFormat('footer', props.format)
Expand Down
2 changes: 1 addition & 1 deletion src/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import Button from './WidgetButton';
import Button from './Button';

export default React.createClass({
displayName: 'Header',
Expand Down
2 changes: 1 addition & 1 deletion src/NumberPicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { directions } from './util/constants';
import repeater from './util/repeater';
import { number as numberLocalizer } from './util/localizers';
import Input from './NumberInput';
import Button from './WidgetButton';
import Button from './Button';

import { widgetEditable } from './util/interaction';
import { notify } from './util/widgetHelpers';
Expand Down
2 changes: 1 addition & 1 deletion src/Select.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import cn from 'classnames';

import Button from './WidgetButton';
import Button from './Button';

class Select extends React.Component {

Expand Down

0 comments on commit 8409875

Please sign in to comment.