{"action":"created","issue":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/2931","repository_url":"https://api.github.com/repos/mapbox/mapbox-gl-js","labels_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/2931/labels{/name}","comments_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/2931/comments","events_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/2931/events","html_url":"https://github.com/mapbox/mapbox-gl-js/issues/2931","id":168942127,"number":2931,"title":"stop propagation on mouse events in Popup","user":{"login":"mollymerp","id":2425307,"avatar_url":"https://avatars.githubusercontent.com/u/2425307?v=3","gravatar_id":"","url":"https://api.github.com/users/mollymerp","html_url":"https://github.com/mollymerp","followers_url":"https://api.github.com/users/mollymerp/followers","following_url":"https://api.github.com/users/mollymerp/following{/other_user}","gists_url":"https://api.github.com/users/mollymerp/gists{/gist_id}","starred_url":"https://api.github.com/users/mollymerp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mollymerp/subscriptions","organizations_url":"https://api.github.com/users/mollymerp/orgs","repos_url":"https://api.github.com/users/mollymerp/repos","events_url":"https://api.github.com/users/mollymerp/events{/privacy}","received_events_url":"https://api.github.com/users/mollymerp/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mapbox/mapbox-gl-js/labels/bug","name":"bug","color":"0052cc"},{"url":"https://api.github.com/repos/mapbox/mapbox-gl-js/labels/starter%20task","name":"starter task","color":"fbca04"}],"state":"open","locked":false,"assignee":{"login":"mollymerp","id":2425307,"avatar_url":"https://avatars.githubusercontent.com/u/2425307?v=3","gravatar_id":"","url":"https://api.github.com/users/mollymerp","html_url":"https://github.com/mollymerp","followers_url":"https://api.github.com/users/mollymerp/followers","following_url":"https://api.github.com/users/mollymerp/following{/other_user}","gists_url":"https://api.github.com/users/mollymerp/gists{/gist_id}","starred_url":"https://api.github.com/users/mollymerp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mollymerp/subscriptions","organizations_url":"https://api.github.com/users/mollymerp/orgs","repos_url":"https://api.github.com/users/mollymerp/repos","events_url":"https://api.github.com/users/mollymerp/events{/privacy}","received_events_url":"https://api.github.com/users/mollymerp/received_events","type":"User","site_admin":false},"assignees":[{"login":"mollymerp","id":2425307,"avatar_url":"https://avatars.githubusercontent.com/u/2425307?v=3","gravatar_id":"","url":"https://api.github.com/users/mollymerp","html_url":"https://github.com/mollymerp","followers_url":"https://api.github.com/users/mollymerp/followers","following_url":"https://api.github.com/users/mollymerp/following{/other_user}","gists_url":"https://api.github.com/users/mollymerp/gists{/gist_id}","starred_url":"https://api.github.com/users/mollymerp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mollymerp/subscriptions","organizations_url":"https://api.github.com/users/mollymerp/orgs","repos_url":"https://api.github.com/users/mollymerp/repos","events_url":"https://api.github.com/users/mollymerp/events{/privacy}","received_events_url":"https://api.github.com/users/mollymerp/received_events","type":"User","site_admin":false}],"milestone":null,"comments":1,"created_at":"2016-08-02T17:27:44Z","updated_at":"2016-08-22T18:32:07Z","closed_at":null,"body":"In reviewing @YunjieLi 's Marker demo, I discovered that a `Popup` created on a click event to another DOM event, without `closeOnClick` set to `false`, will close itself immediately after being created giving the appearance that the popup class didn't work. \r\n\r\nMinimal example [here](https://jsfiddle.net/madedwqv/2/)\r\n\r\nWe should stop propagation by default in `Popup()`"},"comment":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/comments/241506354","html_url":"https://github.com/mapbox/mapbox-gl-js/issues/2931#issuecomment-241506354","issue_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/2931","id":241506354,"user":{"login":"jfirebaugh","id":98601,"avatar_url":"https://avatars.githubusercontent.com/u/98601?v=3","gravatar_id":"","url":"https://api.github.com/users/jfirebaugh","html_url":"https://github.com/jfirebaugh","followers_url":"https://api.github.com/users/jfirebaugh/followers","following_url":"https://api.github.com/users/jfirebaugh/following{/other_user}","gists_url":"https://api.github.com/users/jfirebaugh/gists{/gist_id}","starred_url":"https://api.github.com/users/jfirebaugh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfirebaugh/subscriptions","organizations_url":"https://api.github.com/users/jfirebaugh/orgs","repos_url":"https://api.github.com/users/jfirebaugh/repos","events_url":"https://api.github.com/users/jfirebaugh/events{/privacy}","received_events_url":"https://api.github.com/users/jfirebaugh/received_events","type":"User","site_admin":false},"created_at":"2016-08-22T18:32:07Z","updated_at":"2016-08-22T18:32:07Z","body":"Interesting example! Can you say more about what you mean by stopping propagation in `Popup`? It's not clear to me how that would resolve the situation here:\r\n\r\n1. `click` event sent to `marker_el` listener, which creates and adds the `Popup`.\r\n2. `click` event bubbles to the canvas container, triggering the map `click` event.\r\n3. Map `click` event triggers `Popup:: _onClickClose`.\r\n\r\nThe possible solutions I see are:\r\n\r\n1. Fix this specific example directly, by stopping propagation in the `marker_el` listener.\r\n2. In `Popup::addTo`, delay binding `Popup:: _onClickClose` until the next tick.\r\n\r\nI prefer the first solution, as in my experience when you mix asynchronicity and event bindings at the library level, it starts to become difficult to reason about the behavior. In Leaflet I recall seeing fixes of this sort cause regressions elsewhere."}}
{"actor":{"display_login":"jfirebaugh"}}