{"action":"opened","issue":{"url":"https://api.github.com/repos/oppia/oppia/issues/2686","repository_url":"https://api.github.com/repos/oppia/oppia","labels_url":"https://api.github.com/repos/oppia/oppia/issues/2686/labels{/name}","comments_url":"https://api.github.com/repos/oppia/oppia/issues/2686/comments","events_url":"https://api.github.com/repos/oppia/oppia/issues/2686/events","html_url":"https://github.com/oppia/oppia/issues/2686","id":186984342,"number":2686,"title":"Text input does not autofocus properly after wrong answer is submitted.","user":{"login":"seanlip","id":10575562,"avatar_url":"https://avatars.githubusercontent.com/u/10575562?v=3","gravatar_id":"","url":"https://api.github.com/users/seanlip","html_url":"https://github.com/seanlip","followers_url":"https://api.github.com/users/seanlip/followers","following_url":"https://api.github.com/users/seanlip/following{/other_user}","gists_url":"https://api.github.com/users/seanlip/gists{/gist_id}","starred_url":"https://api.github.com/users/seanlip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seanlip/subscriptions","organizations_url":"https://api.github.com/users/seanlip/orgs","repos_url":"https://api.github.com/users/seanlip/repos","events_url":"https://api.github.com/users/seanlip/events{/privacy}","received_events_url":"https://api.github.com/users/seanlip/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-03T06:02:36Z","updated_at":"2016-11-03T06:02:36Z","closed_at":null,"body":"To reproduce: load the welcome exploration, play through the first state, then type a wrong answer in the box that expects \"Finnish\". The focus does not return back to the text input field, and the user has to click it manually before they can type their answer.\r\n\r\nI investigated this a bit, and I think there is a race condition in the learner view. Changing the $timeout in focusService.setFocus() to fire after 1000 ms \"fixes\" this, and adding console.log statements to setFocus() and to focusOn() in directives.js suggest that the focus label on the input field is not getting broadcasted to, perhaps because there is a delay in showing the input field in the first place and the broadcast happens before the input field is shown. In addition, while doing this logging, I noticed some odd behaviour in the focus label that is being passed around (the \"clear focus\" label seems to be being used, and I also saw `content-focus-label-undefined` when logging the events received by the focusOn directive), so some investigation and tidy-up is probably needed.\r\n\r\nAlso, in the e2e tests that test the learner view, it would be nice to remove the additional click that is needed to focus on the input field, so that things like this are caught."}}
{"actor":{"display_login":"seanlip"}}