Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature suggestion: setting 'active' prop causes field to gain focus #8

Closed
jcheroske opened this issue Jun 29, 2016 · 2 comments
Closed

Comments

@jcheroske
Copy link

I'm curious about the possibility of having the active prop cause the underlying material-ui component to gain focus. It seems that, when a component gains focus, it calls an onFocus callback that's been handed to it by redux-form. This callback fires a FOCUS action, which results in a state mutation and the active flag being set on the ui component. Could the setting of the active field state, via the reducer plugin, do the reverse and cause the field's focus() method to be called? Right now, messing with the state directly does cause the active prop to be properly set on the ui component. But the component does not translate that into a call to its focus() method, afaik. These wrappers could see the change to the active prop and pass that down to the material ui component via a ref call. mui/material-ui#1594 demonstrates how to set focus on a mui field programmatically.

@erikras
Copy link
Owner

erikras commented Jul 6, 2016

Seems potentially possible, yes.

@erikras
Copy link
Owner

erikras commented Aug 2, 2016

I tried this, and it doesn't work. I'm calling this.refs.component.focus() whenever the props.meta.active changes from false to true, and it doesn't actually do anything. Bummer... 😢

@erikras erikras closed this as completed Aug 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants