parent
04ed53e0f2
commit
0f41c5b847
@ -30,15 +30,22 @@ export default class Container extends Component {
|
|||||||
compact: PropTypes.bool,
|
compact: PropTypes.bool,
|
||||||
light: PropTypes.bool,
|
light: PropTypes.bool,
|
||||||
style: PropTypes.object,
|
style: PropTypes.object,
|
||||||
|
tabIndex: PropTypes.number,
|
||||||
title: nodeOrStringProptype()
|
title: nodeOrStringProptype()
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { children, className, compact, light, style } = this.props;
|
const { children, className, compact, light, style, tabIndex } = this.props;
|
||||||
const classes = `${styles.container} ${light ? styles.light : ''} ${className}`;
|
const classes = `${styles.container} ${light ? styles.light : ''} ${className}`;
|
||||||
|
|
||||||
|
const props = {};
|
||||||
|
|
||||||
|
if (Number.isInteger(tabIndex)) {
|
||||||
|
props.tabIndex = tabIndex;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={ classes } style={ style }>
|
<div className={ classes } style={ style } { ...props }>
|
||||||
<Card className={ compact ? styles.compact : styles.padded }>
|
<Card className={ compact ? styles.compact : styles.padded }>
|
||||||
{ this.renderTitle() }
|
{ this.renderTitle() }
|
||||||
{ children }
|
{ children }
|
||||||
|
@ -18,6 +18,7 @@ import { Dialog } from 'material-ui';
|
|||||||
import React, { Component, PropTypes } from 'react';
|
import React, { Component, PropTypes } from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { bindActionCreators } from 'redux';
|
import { bindActionCreators } from 'redux';
|
||||||
|
import ReactDOM from 'react-dom';
|
||||||
|
|
||||||
import { nodeOrStringProptype } from '~/util/proptypes';
|
import { nodeOrStringProptype } from '~/util/proptypes';
|
||||||
|
|
||||||
@ -49,6 +50,14 @@ class Modal extends Component {
|
|||||||
waiting: PropTypes.array
|
waiting: PropTypes.array
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidMount () {
|
||||||
|
const element = ReactDOM.findDOMNode(this.refs.dialog);
|
||||||
|
|
||||||
|
if (element) {
|
||||||
|
element.focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { muiTheme } = this.context;
|
const { muiTheme } = this.context;
|
||||||
const { actions, busy, children, className, current, compact, settings, steps, title, visible, waiting } = this.props;
|
const { actions, busy, children, className, current, compact, settings, steps, title, visible, waiting } = this.props;
|
||||||
@ -85,9 +94,12 @@ class Modal extends Component {
|
|||||||
<Container
|
<Container
|
||||||
compact={ compact }
|
compact={ compact }
|
||||||
light
|
light
|
||||||
|
ref='dialog'
|
||||||
style={
|
style={
|
||||||
{ transition: 'none' }
|
{ transition: 'none' }
|
||||||
}>
|
}
|
||||||
|
tabIndex={ 0 }
|
||||||
|
>
|
||||||
{ children }
|
{ children }
|
||||||
</Container>
|
</Container>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
Loading…
Reference in New Issue
Block a user