{"action":"created","issue":{"url":"https://api.github.com/repos/hypothesis/h/issues/3257","repository_url":"https://api.github.com/repos/hypothesis/h","labels_url":"https://api.github.com/repos/hypothesis/h/issues/3257/labels{/name}","comments_url":"https://api.github.com/repos/hypothesis/h/issues/3257/comments","events_url":"https://api.github.com/repos/hypothesis/h/issues/3257/events","html_url":"https://github.com/hypothesis/h/pull/3257","id":151625314,"number":3257,"title":"Show adder if user makes a selection and then launches the plugin.","user":{"login":"robertknight","id":2458,"avatar_url":"https://avatars.githubusercontent.com/u/2458?v=3","gravatar_id":"","url":"https://api.github.com/users/robertknight","html_url":"https://github.com/robertknight","followers_url":"https://api.github.com/users/robertknight/followers","following_url":"https://api.github.com/users/robertknight/following{/other_user}","gists_url":"https://api.github.com/users/robertknight/gists{/gist_id}","starred_url":"https://api.github.com/users/robertknight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertknight/subscriptions","organizations_url":"https://api.github.com/users/robertknight/orgs","repos_url":"https://api.github.com/users/robertknight/repos","events_url":"https://api.github.com/users/robertknight/events{/privacy}","received_events_url":"https://api.github.com/users/robertknight/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":19,"created_at":"2016-04-28T12:08:18Z","updated_at":"2016-04-29T17:56:51Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/hypothesis/h/pulls/3257","html_url":"https://github.com/hypothesis/h/pull/3257","diff_url":"https://github.com/hypothesis/h/pull/3257.diff","patch_url":"https://github.com/hypothesis/h/pull/3257.patch"},"body":"If a user selects some text, and then realises that Hypothesis isn't\r\nactive, their first reaction will probably be to activate Hypothesis.\r\nIn this scenario, we should pop up the adder near the selection on launch.\r\n\r\n * If there is a selection when the 'ready' event fires, show the adder\r\n   at the focus point of the selection.\r\n\r\n * For consistency, show the adder at the focus point of the selection\r\n   after a selection whilst Hypothesis is active.\r\n\r\n * Add 'range-util' module which provides utility functions to get\r\n   the coordinates at the end of the selection.\r\n\r\n   'range-util' uses the DOM Range, Selection and NodeIterator APIs directly\r\n   rather than Annotator's Range functions for several reasons:\r\n\r\n   1) Given that H now requires IE >= 10, all of our target browsers\r\n      have all the APIs that we need.\r\n\r\n   2) Using the DOM APIs directly proved easier to debug and test."},"comment":{"url":"https://api.github.com/repos/hypothesis/h/issues/comments/215830321","html_url":"https://github.com/hypothesis/h/pull/3257#issuecomment-215830321","issue_url":"https://api.github.com/repos/hypothesis/h/issues/3257","id":215830321,"user":{"login":"robertknight","id":2458,"avatar_url":"https://avatars.githubusercontent.com/u/2458?v=3","gravatar_id":"","url":"https://api.github.com/users/robertknight","html_url":"https://github.com/robertknight","followers_url":"https://api.github.com/users/robertknight/followers","following_url":"https://api.github.com/users/robertknight/following{/other_user}","gists_url":"https://api.github.com/users/robertknight/gists{/gist_id}","starred_url":"https://api.github.com/users/robertknight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertknight/subscriptions","organizations_url":"https://api.github.com/users/robertknight/orgs","repos_url":"https://api.github.com/users/robertknight/repos","events_url":"https://api.github.com/users/robertknight/events{/privacy}","received_events_url":"https://api.github.com/users/robertknight/received_events","type":"User","site_admin":false},"created_at":"2016-04-29T17:56:51Z","updated_at":"2016-04-29T17:56:51Z","body":"> However, I think it's to do with wanting the adder to appear near where the mouse is?\r\n> As can be seen in multiline selections:\r\n\r\nYes. The idea is that the logic is basic but should give reasonable results and feel predictable.\r\n\r\n> Completely in view plus a few pixels space before the edge would be nicer imo.\r\n\r\nYes. The bigger problem right now is that the sidebar is prone to popping open and covering up everything when you make a selection near the right edge of the window. I think that's something to come back to separately."}}