Commit a355c458 authored by Nick Stenning's avatar Nick Stenning

Fix share dialog

Previously, the event from the initial click on the "share" event was
swallowed by the click handler on the parent thread:

    https://github.com/hypothesis/h/blob/fef9f43/h/static/scripts/directives/thread.coffee#L198-L221

Removing this has meant that the share dialog never shows.

Incidentally, this also fixes #1802, which was caused by the same code
in the thread directive, which swallowed all click events from its
children and hence prevented the closure of the share dialog.
parent 05683b6e
...@@ -314,10 +314,15 @@ annotationDirective = [ ...@@ -314,10 +314,15 @@ annotationDirective = [
ctrl.save() ctrl.save()
scope.share = (event) -> scope.share = (event) ->
scope.$evalAsync -> $container = angular.element(event.target).parent()
$container = angular.element(event.target).parent() $container.addClass('open').find('input').focus().select()
$container.addClass('open').find('input').focus().select()
$document.one('click', (event) -> $container.removeClass('open')) # We have to stop propagation here otherwise this click event will
# re-close the share dialog immediately.
event.stopPropagation()
$document.one('click', (event) -> $container.removeClass('open'))
return
# Keep track of edits going on in the thread. # Keep track of edits going on in the thread.
if counter? if counter?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment