{"action":"created","issue":{"url":"https://api.github.com/repos/dmauro/Keypress/issues/84","labels_url":"https://api.github.com/repos/dmauro/Keypress/issues/84/labels{/name}","comments_url":"https://api.github.com/repos/dmauro/Keypress/issues/84/comments","events_url":"https://api.github.com/repos/dmauro/Keypress/issues/84/events","html_url":"https://github.com/dmauro/Keypress/issues/84","id":57511791,"number":84,"title":"key_up not fired if focus changes","user":{"login":"beaudesigns","id":193887,"avatar_url":"https://avatars.githubusercontent.com/u/193887?v=3","gravatar_id":"","url":"https://api.github.com/users/beaudesigns","html_url":"https://github.com/beaudesigns","followers_url":"https://api.github.com/users/beaudesigns/followers","following_url":"https://api.github.com/users/beaudesigns/following{/other_user}","gists_url":"https://api.github.com/users/beaudesigns/gists{/gist_id}","starred_url":"https://api.github.com/users/beaudesigns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beaudesigns/subscriptions","organizations_url":"https://api.github.com/users/beaudesigns/orgs","repos_url":"https://api.github.com/users/beaudesigns/repos","events_url":"https://api.github.com/users/beaudesigns/events{/privacy}","received_events_url":"https://api.github.com/users/beaudesigns/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-12T20:03:03Z","updated_at":"2015-02-12T20:08:33Z","closed_at":null,"body":"So I have a bit of a weird issue that took me forever to track down. The use case is this:\r\n\r\n1. I'm focused on an element that has hotkeys, in this case \"enter\" to select the item.\r\n2. When the item is selected, a new element is created that takes the focus. (`newElement.focus()`)\r\n3. When complete with the new element, we close it with Escape.\r\n4. Focus comes back to the original element.\r\n\r\nThis works great, except in one circumstance. If the new element takes focus before the `keyup` event happens, the Keypress._keys_down array still shows that there is a key pressed! This causes issues for any other hotkeys that have `is_solitary` set to `true`.\r\n\r\nClear as mud?\r\n\r\nThe solution that I have implemented is, when the original element gets a regular blur event. I call `listener.blur_event()` which clears the array for when I come back to it.\r\n\r\nIf you need me to clarify further, or if there are any questions, please let me know!"},"comment":{"url":"https://api.github.com/repos/dmauro/Keypress/issues/comments/74142913","html_url":"https://github.com/dmauro/Keypress/issues/84#issuecomment-74142913","issue_url":"https://api.github.com/repos/dmauro/Keypress/issues/84","id":74142913,"user":{"login":"beaudesigns","id":193887,"avatar_url":"https://avatars.githubusercontent.com/u/193887?v=3","gravatar_id":"","url":"https://api.github.com/users/beaudesigns","html_url":"https://github.com/beaudesigns","followers_url":"https://api.github.com/users/beaudesigns/followers","following_url":"https://api.github.com/users/beaudesigns/following{/other_user}","gists_url":"https://api.github.com/users/beaudesigns/gists{/gist_id}","starred_url":"https://api.github.com/users/beaudesigns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beaudesigns/subscriptions","organizations_url":"https://api.github.com/users/beaudesigns/orgs","repos_url":"https://api.github.com/users/beaudesigns/repos","events_url":"https://api.github.com/users/beaudesigns/events{/privacy}","received_events_url":"https://api.github.com/users/beaudesigns/received_events","type":"User","site_admin":false},"created_at":"2015-02-12T20:08:33Z","updated_at":"2015-02-12T20:08:33Z","body":"To clarify, I'm not sure that this is something that can, or should be fixed without radically changing the behavior of Keypress.js. Someone much smarter than me will have to think it through."}}