Skip to content

Commit

Permalink
Allow changing type/role of buttons (palantir#311)
Browse files Browse the repository at this point in the history
Also support changing `tabIndex` on `AnchorButton`. Closes palantir#242.
  • Loading branch information
giladgray authored and adidahiya committed Dec 6, 2016
1 parent d8af99d commit a77d928
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/core/src/components/button/buttons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ export class Button extends React.Component<React.HTMLProps<HTMLButtonElement> &
const { children, disabled, elementRef, onClick, rightIconName, text } = this.props;
return (
<button
type="button"
{...removeNonHTMLProps(this.props)}
className={getButtonClasses(this.props)}
onClick={disabled ? undefined : onClick}
type="button"
ref={elementRef}
>
{text}
Expand All @@ -49,16 +49,16 @@ export class AnchorButton extends React.Component<React.HTMLProps<HTMLAnchorElem
public static displayName = "Blueprint.AnchorButton";

public render() {
const { children, disabled, href, onClick, rightIconName, text } = this.props;
const { children, disabled, href, onClick, rightIconName, tabIndex = 0, text } = this.props;
return (
<a
role="button"
{...removeNonHTMLProps(this.props)}
className={getButtonClasses(this.props)}
href={disabled ? undefined : href}
onClick={disabled ? undefined : onClick}
ref={this.props.elementRef}
role="button"
tabIndex={disabled ? undefined : 0}
tabIndex={disabled ? undefined : tabIndex}
>
{text}
{children}
Expand Down

0 comments on commit a77d928

Please sign in to comment.