{"action":"opened","issue":{"url":"https://api.github.com/repos/erikras/redux-form/issues/1001","repository_url":"https://api.github.com/repos/erikras/redux-form","labels_url":"https://api.github.com/repos/erikras/redux-form/issues/1001/labels{/name}","comments_url":"https://api.github.com/repos/erikras/redux-form/issues/1001/comments","events_url":"https://api.github.com/repos/erikras/redux-form/issues/1001/events","html_url":"https://github.com/erikras/redux-form/issues/1001","id":155563375,"number":1001,"title":"Race condition between blur and focus causes active state to be lost","user":{"login":"kpdecker","id":196390,"avatar_url":"https://avatars.githubusercontent.com/u/196390?v=3","gravatar_id":"","url":"https://api.github.com/users/kpdecker","html_url":"https://github.com/kpdecker","followers_url":"https://api.github.com/users/kpdecker/followers","following_url":"https://api.github.com/users/kpdecker/following{/other_user}","gists_url":"https://api.github.com/users/kpdecker/gists{/gist_id}","starred_url":"https://api.github.com/users/kpdecker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kpdecker/subscriptions","organizations_url":"https://api.github.com/users/kpdecker/orgs","repos_url":"https://api.github.com/users/kpdecker/repos","events_url":"https://api.github.com/users/kpdecker/events{/privacy}","received_events_url":"https://api.github.com/users/kpdecker/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-18T17:54:17Z","updated_at":"2016-05-18T17:54:17Z","closed_at":null,"body":"In my app I have a meta field that consists of multiple other fields (in this case, checkboxes). Rather than sending many focus and blur operations, I try to filter this to a single external `onFocus` and `onBlur` call via a setTimeout, i.e:\r\n\r\n```\r\n  onFocus() {\r\n    if (!this.props.onFocus) {\r\n      return;\r\n    }\r\n\r\n    clearTimeout(this.blurTimeout);\r\n\r\n    if (!this.focused) {\r\n      this.focused = true;\r\n      this.props.onFocus(this.props.value);\r\n    }\r\n  }\r\n  onBlur() {\r\n    if (!this.props.onBlur) {\r\n      return;\r\n    }\r\n\r\n    this.blurTimeout = setTimeout(() => {\r\n      this.focused = false;\r\n      this.props.onBlur(this.props.value);\r\n    }, 50);\r\n  }\r\n```\r\n\r\nThis pattern apparently exposes a race condition between `onBlur` and `onFocus` calls between two fields. The timeout above causes `onBlur` to occur after `onFocus` for the field that receives focus, causing the `_active` state to be removed even though the other field still maintains focus at the user level. So my question is if the blur handler should check to ensure that it's not interacting with the form-level state when it's no longer the target field?\r\n\r\nSomething like:\r\n\r\n```\r\n  [BLUR](state, {field, value, touch}) {\r\n    // remove _active from state\r\n    const {_active, ...stateCopy} = state;  // eslint-disable-line prefer-const\r\n    if (field !== _active) {\r\n      stateCopy._active = _active;\r\n    }\r\n```"}}