{"action":"opened","issue":{"url":"https://api.github.com/repos/bem/bem-components/issues/1377","labels_url":"https://api.github.com/repos/bem/bem-components/issues/1377/labels{/name}","comments_url":"https://api.github.com/repos/bem/bem-components/issues/1377/comments","events_url":"https://api.github.com/repos/bem/bem-components/issues/1377/events","html_url":"https://github.com/bem/bem-components/issues/1377","id":59046063,"number":1377,"title":"popup: reattach to body occurs after popup already visible","user":{"login":"Guria","id":36270,"avatar_url":"https://avatars.githubusercontent.com/u/36270?v=3","gravatar_id":"","url":"https://api.github.com/users/Guria","html_url":"https://github.com/Guria","followers_url":"https://api.github.com/users/Guria/followers","following_url":"https://api.github.com/users/Guria/following{/other_user}","gists_url":"https://api.github.com/users/Guria/gists{/gist_id}","starred_url":"https://api.github.com/users/Guria/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Guria/subscriptions","organizations_url":"https://api.github.com/users/Guria/orgs","repos_url":"https://api.github.com/users/Guria/repos","events_url":"https://api.github.com/users/Guria/events{/privacy}","received_events_url":"https://api.github.com/users/Guria/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-02-26T09:45:08Z","updated_at":"2015-02-26T09:45:08Z","closed_at":null,"body":"https://github.com/bem/bem-components/blob/v2/common.blocks/popup/popup.js#L41\r\nI have an issue with custom styles for popup animation. First time `popup` appears immediately without animation. It caused by reattach to `document.body`.\r\nIt could be solved by moving out handlers for mod `visible` from `onSetMod` to `onBeforeSetMod`.\r\nAnother way is perform reattach in `_js_inited` handler.\r\nBoth solutions works fine for me.\r\nAlso take a note that it is not save to assume that BEMDOM.scope will contain `document.body` because it could be redefined. See [this forum post](https://github.com/bem/bem-forum-content-ru/issues/237) for reference."}}