{"action":"created","issue":{"url":"https://api.github.com/repos/ClinGen/clincoded/issues/270","labels_url":"https://api.github.com/repos/ClinGen/clincoded/issues/270/labels{/name}","comments_url":"https://api.github.com/repos/ClinGen/clincoded/issues/270/comments","events_url":"https://api.github.com/repos/ClinGen/clincoded/issues/270/events","html_url":"https://github.com/ClinGen/clincoded/pull/270","id":103997077,"number":270,"title":"Connects to #144 prevent enter/return from closing add PMID/OMIM ID modals","user":{"login":"kilodalton","id":1878194,"avatar_url":"https://avatars.githubusercontent.com/u/1878194?v=3","gravatar_id":"","url":"https://api.github.com/users/kilodalton","html_url":"https://github.com/kilodalton","followers_url":"https://api.github.com/users/kilodalton/followers","following_url":"https://api.github.com/users/kilodalton/following{/other_user}","gists_url":"https://api.github.com/users/kilodalton/gists{/gist_id}","starred_url":"https://api.github.com/users/kilodalton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kilodalton/subscriptions","organizations_url":"https://api.github.com/users/kilodalton/orgs","repos_url":"https://api.github.com/users/kilodalton/repos","events_url":"https://api.github.com/users/kilodalton/events{/privacy}","received_events_url":"https://api.github.com/users/kilodalton/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ClinGen/clincoded/labels/in%20progress","name":"in progress","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-31T06:40:38Z","updated_at":"2015-08-31T23:11:00Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ClinGen/clincoded/pulls/270","html_url":"https://github.com/ClinGen/clincoded/pull/270","diff_url":"https://github.com/ClinGen/clincoded/pull/270.diff","patch_url":"https://github.com/ClinGen/clincoded/pull/270.patch"},"body":"In this implementation for the PMID and OMIM ID add/change modals the \"Cancel\" button (or first button after input field  [if the \"Submit\" button were before the Cancel button that would be the default instead]) becomes the new target after a user has clicked in the input field (even if the input field is still highlighted as \"active\"). Subsequently hitting \"enter\" (which is then being interpreted as a \"mouse click\" event on the cancel button) then triggers the modal to close without submitting any info present in the input field  or warning that the info entered is being discarded (the \"Cancel\" button is linked to the \"cancelForm\" method which only closes the modal).\r\n\r\nUsing the event.detail property in cancelForm we can determine if the user has actually clicked the cancel button (not just the hit return/enter [we are unable to capture the keycode of the keypress currently]) because there are no actual mouse clicks on \"Cancel\" if you just hit return/enter. https://developer.mozilla.org/en-US/docs/Web/API/Event/detail\r\n\r\nThis PR adds a check that the number of clicks is more than 1 to prevent the form from being submitted on \"Return/Enter\". The React SyntheticMouseEvent.detail associated with pressing return/enter has a value of 0 while an actual click is 1 (double click would be 2). The SyntheticMouseEvent does not have keypress charcode info (to check for charcode===13) which can be used in this case.\r\n\r\nTo test PMID:\r\n-Create GDM\r\n-Click button to add PMID (modal opens)\r\n-Click \"Cancel\" (modal closes)\r\n-Click button to add PMID (modal opens)\r\n-Click inside text box, hit \"Enter\" (modal remains open)\r\n-Click inside text box, enter numbers, hit \"Enter\" (modal remains open)\r\n-Click \"Cancel\" (PMID modal closes)\r\n-Click button to add PMID (modal opens)\r\n-Click inside text box, add numbers, hit \"Enter\" (modal remains open)\r\n-Click \"Add Article\" (pmid is added, modal closes, new pmid info is selected/displayed on GDM)\r\n\r\nTo test OMIM ID modal:\r\n-Create GDM\r\n-Click \"Add\" to add OMIM (modal opens)\r\n-Click \"Cancel\" (modal closes)\r\n-Click button to add OMIM (modal opens)\r\n-Click inside text box, hit \"Enter\" (modal remains open)\r\n-Click inside text box, enter numbers, hit \"Enter\" (modal remains open)\r\n-Click \"Cancel\" (OMIM modal closes)\r\n-Click button to add OMIM (modal opens)\r\n-Click inside text box, add numbers, hit \"Enter\" (modal remains open)\r\n-Click \"Add OMIM\" (OMIM is added, modal closes, new OMIM info is displayed on GDM)\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ClinGen/clincoded/issues/comments/136524540","html_url":"https://github.com/ClinGen/clincoded/pull/270#issuecomment-136524540","issue_url":"https://api.github.com/repos/ClinGen/clincoded/issues/270","id":136524540,"user":{"login":"kilodalton","id":1878194,"avatar_url":"https://avatars.githubusercontent.com/u/1878194?v=3","gravatar_id":"","url":"https://api.github.com/users/kilodalton","html_url":"https://github.com/kilodalton","followers_url":"https://api.github.com/users/kilodalton/followers","following_url":"https://api.github.com/users/kilodalton/following{/other_user}","gists_url":"https://api.github.com/users/kilodalton/gists{/gist_id}","starred_url":"https://api.github.com/users/kilodalton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kilodalton/subscriptions","organizations_url":"https://api.github.com/users/kilodalton/orgs","repos_url":"https://api.github.com/users/kilodalton/repos","events_url":"https://api.github.com/users/kilodalton/events{/privacy}","received_events_url":"https://api.github.com/users/kilodalton/received_events","type":"User","site_admin":false},"created_at":"2015-08-31T23:11:00Z","updated_at":"2015-08-31T23:11:00Z","body":"@forresttanaka I actually think it is visually better if the \"Add\" button remains blue as a easy visual target for the user...and this also clearly differentiates it from the Cancel which is right next to it.\r\n\r\nExisting:\r\n![image](https://cloud.githubusercontent.com/assets/1878194/9592705/5e93a212-4ffa-11e5-93f0-ce6b04aab07a.png)\r\n\r\nProposed change to make Add button to look and feel of Cancel button (both white):\r\n![image](https://cloud.githubusercontent.com/assets/1878194/9592693/487faf16-4ffa-11e5-8aed-a8122e0a1fb0.png)\r\n\r\nI'd like to keep the \"Add\" button blue.\r\n"}}