Commit dbbeadf8 authored by Robert Knight's avatar Robert Knight

Use Element.scrollIntoView() to scroll new annotations into view

The previous method of scrolling a newly created annotation
into view in the sidebar resulted in the input field for
the new annotation losing focus.

Note that only top level annotations have an 'id'
attribute set on the corresponding HTML element.
It might make sense to change this in future although
it would add an extra binding. For now I've just noted this.
parent ec0e0f9f
...@@ -229,7 +229,10 @@ module.exports = [ ...@@ -229,7 +229,10 @@ module.exports = [
ctrl.container = thread ctrl.container = thread
if ctrl.isNew() if ctrl.isNew()
# Scroll the sidebar to show new annotations. # Scroll the sidebar to show new annotations.
$location.hash(ctrl.id) # Note that only top level annotation cards have their ID set
annotationCard = document.getElementById(ctrl.id)
if annotationCard
annotationCard.scrollIntoView();
scope.$digest() scope.$digest()
controller: ThreadController controller: ThreadController
......
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