Skip to content

Commit

Permalink
[ButtonBase] Fix missing keyboard ripple (mui#8723)
Browse files Browse the repository at this point in the history
  • Loading branch information
sakulstra authored and the-noob committed Nov 17, 2017
1 parent 5600980 commit 9cead46
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/src/pages/demos/dialogs/AlertDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default class AlertDialog extends React.Component {
<Button onClick={this.handleRequestClose} color="primary">
Disagree
</Button>
<Button onClick={this.handleRequestClose} color="primary">
<Button onClick={this.handleRequestClose} color="primary" autoFocus>
Agree
</Button>
</DialogActions>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/demos/dialogs/ConfirmationDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class ConfirmationDialog extends React.Component {
<DialogTitle>Phone Ringtone</DialogTitle>
<DialogContent>
<RadioGroup
innerRef={node => {
ref={node => {
this.radioGroup = node;
}}
aria-label="ringtone"
Expand Down
11 changes: 7 additions & 4 deletions src/ButtonBase/ButtonBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,15 @@ class ButtonBase extends React.Component<ProvidedProps & Props, State> {
return;
}

if (this.button) {
event.persist();
const keyboardFocusCallback = this.onKeyboardFocusHandler.bind(this, event);
detectKeyboardFocus(this, this.button, keyboardFocusCallback);
// Fix for https://github.com/facebook/react/issues/7769
if (!this.button) {
this.button = event.currentTarget;
}

event.persist();
const keyboardFocusCallback = this.onKeyboardFocusHandler.bind(this, event);
detectKeyboardFocus(this, this.button, keyboardFocusCallback);

if (this.props.onFocus) {
this.props.onFocus(event);
}
Expand Down

0 comments on commit 9cead46

Please sign in to comment.