Skip to content

Commit

Permalink
Fixed focus for inked components
Browse files Browse the repository at this point in the history
Updated the injectInk HOC so that it will still correctly focus itself
if the ink is disabled.

Closes #666  #EVILLLL
  • Loading branch information
mlaursen committed Jan 9, 2018
1 parent 1fc5b0b commit f47bf22
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/js/Inks/injectInk.js
@@ -1,4 +1,5 @@
import React, { PureComponent } from 'react';
import { findDOMNode } from 'react-dom';
import PropTypes from 'prop-types';

import getField from '../utils/getField';
Expand Down Expand Up @@ -156,7 +157,12 @@ export default ComposedComponent => class InkedComponent extends PureComponent {
* ```
*/
focus = () => {
if (this._inkContainer) {
if (this.props.inkDisabled) {
const composed = findDOMNode(this._composed);
if (composed) {
composed.focus();
}
} else if (this._inkContainer) {
this._inkContainer.focus();
}
};
Expand Down

0 comments on commit f47bf22

Please sign in to comment.