{"action":"created","issue":{"url":"https://api.github.com/repos/mattermost/platform/issues/4610","repository_url":"https://api.github.com/repos/mattermost/platform","labels_url":"https://api.github.com/repos/mattermost/platform/issues/4610/labels{/name}","comments_url":"https://api.github.com/repos/mattermost/platform/issues/4610/comments","events_url":"https://api.github.com/repos/mattermost/platform/issues/4610/events","html_url":"https://github.com/mattermost/platform/pull/4610","id":190579470,"number":4610,"title":"PLT-4783 Fix autofocus for \"Add/Manage Members\" and \"More public channels\" modals","user":{"login":"fraziern","id":963391,"avatar_url":"https://avatars.githubusercontent.com/u/963391?v=3","gravatar_id":"","url":"https://api.github.com/users/fraziern","html_url":"https://github.com/fraziern","followers_url":"https://api.github.com/users/fraziern/followers","following_url":"https://api.github.com/users/fraziern/following{/other_user}","gists_url":"https://api.github.com/users/fraziern/gists{/gist_id}","starred_url":"https://api.github.com/users/fraziern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fraziern/subscriptions","organizations_url":"https://api.github.com/users/fraziern/orgs","repos_url":"https://api.github.com/users/fraziern/repos","events_url":"https://api.github.com/users/fraziern/events{/privacy}","received_events_url":"https://api.github.com/users/fraziern/received_events","type":"User","site_admin":false},"labels":[{"id":297541710,"url":"https://api.github.com/repos/mattermost/platform/labels/1:%20PM%20Review","name":"1: PM Review","color":"006b75","default":false},{"id":308747687,"url":"https://api.github.com/repos/mattermost/platform/labels/Setup%20Test%20Server","name":"Setup Test Server","color":"0052cc","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-11-20T19:55:47Z","updated_at":"2016-11-22T02:02:49Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mattermost/platform/pulls/4610","html_url":"https://github.com/mattermost/platform/pull/4610","diff_url":"https://github.com/mattermost/platform/pull/4610.diff","patch_url":"https://github.com/mattermost/platform/pull/4610.patch"},"body":"This is a draft PR, as I think more conversation is necessary here. There are a couple of changes here I'm pretty sure about: \r\n\r\n - `web_client.jsx`: this is just changed in anticipation of #4603 being merged, because otherwise my local repo crashes;\r\n - `channel_invite_modal.jsx, member_list_team.jsx`: I think these need to pass the prop `focusOnMount` to their `SearchableUserList` components so that autofocus works properly;\r\n\r\n***The change I'm not sure about is in `sidebar_header_dropdown.jsx`:***\r\n\r\nThis is intended to fix the focus issue when you select \"Manage Members\" from the sidebar dropdown. Selecting this seems to do 2 things synchronously, (1) hide the dropdown, and (2) show the modal. The problem seems to be that both actions want to grab focus, at the same time.\r\n\r\nThe react-bootstrap Dropdown component will check focus whenever it updates. When it toggles off, if the menu has focus still, the toggle button tries to retain focus. If it doesn't it doesn't. Here, with both the modal and the dropdown getting toggled at the same time, the most likely chain of events is:\r\n\r\n 1. modal appears;\r\n 1. menu still has focus when the modal appears, so `Dropdown` calls `focus()` on the toggle button;\r\n 1. the modal calls `focus()` on its search bar;\r\n 1. the toggle button finally takes focus.\r\n\r\nMy proposed solution (after trying a couple of things) is to pass an \"onLoad\" function prop to the `TeamMembersModal` that gets run when the modal is mounted. This function is just the dropdown's `toggleDropdown` method. So in effect, the modal is mounted, *then* the dropdown is hidden, and the dropdown doesn't try to take focus because it detects that something else besides itself has focus.\r\n\r\n#### Ticket Link\r\nSee issue #4599\r\n\r\n#### Checklist\r\n[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]\r\n- [X] Has UI changes\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/mattermost/platform/issues/comments/262126402","html_url":"https://github.com/mattermost/platform/pull/4610#issuecomment-262126402","issue_url":"https://api.github.com/repos/mattermost/platform/issues/4610","id":262126402,"user":{"login":"fraziern","id":963391,"avatar_url":"https://avatars.githubusercontent.com/u/963391?v=3","gravatar_id":"","url":"https://api.github.com/users/fraziern","html_url":"https://github.com/fraziern","followers_url":"https://api.github.com/users/fraziern/followers","following_url":"https://api.github.com/users/fraziern/following{/other_user}","gists_url":"https://api.github.com/users/fraziern/gists{/gist_id}","starred_url":"https://api.github.com/users/fraziern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fraziern/subscriptions","organizations_url":"https://api.github.com/users/fraziern/orgs","repos_url":"https://api.github.com/users/fraziern/repos","events_url":"https://api.github.com/users/fraziern/events{/privacy}","received_events_url":"https://api.github.com/users/fraziern/received_events","type":"User","site_admin":false},"created_at":"2016-11-22T02:02:49Z","updated_at":"2016-11-22T02:02:49Z","body":"OK I think I've worked out a fix for this. Let me know what y'all think."}}
{"actor":{"display_login":"fraziern"}}