Skip to content

Commit

Permalink
Avoid unnecessary scrolling at startup
Browse files Browse the repository at this point in the history
The main fix is removing the fallback navigation to the first tiddler
in story.js. Also required is the fix to the startup behaviour of
zoomin.js.

Fixes #981
  • Loading branch information
Jermolene committed Feb 10, 2015
1 parent b166632 commit 691e571
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 0 additions & 2 deletions core/modules/startup/story.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@ function openStartupTiddlers(options) {
target = target.substr(2,target.length - 4);
}
$tw.wiki.addToHistory(target);
} else if(storyList.length > 0) {
$tw.wiki.addToHistory(storyList[0]);
}
}

Expand Down
2 changes: 1 addition & 1 deletion core/modules/storyviews/zoomin.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var ZoominListView = function(listWidget) {
if(!(domNode instanceof Element)) {
return;
}
if(targetTiddler !== itemWidget.parseTreeNode.itemTitle || (!targetTiddler && index)) {
if((targetTiddler && targetTiddler !== itemWidget.parseTreeNode.itemTitle) || (!targetTiddler && index)) {
domNode.style.display = "none";
} else {
self.currentTiddlerDomNode = domNode;
Expand Down

5 comments on commit 691e571

@aelocson
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jermolene, since this change (probably), I've noticed that when I press F5 to refresh a TiddlyWiki instance in the browser, the story river retains its scroll offset from the previous instance. This is confusing, because the river's content has been reinitialised – so I end up looking at what is effectively a random tiddler.

I've observed this in both Firefox and Chrome.

@Jermolene
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I noticed that too. I think some of the time it may conceivably be useful behaviour; if one were refreshing to see the result of a Node.js change, for example.

A different fix for this problem would have been to maintain the navigation to the first tiddler in story.js, but to refine the scrolling code so that the little mini-scroll isn't performed. It may still be desirable to fix that, as it would also fix the scrolling problem with permalinks (which is not currently fixed).

@aelocson
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's only useful if nothing above the current position in the story river changes when you press F5.

@Jermolene
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which would typically be the case if one was using auto-permaviewing or retaining $:/StoryList.

What do you think would be preferable?

@aelocson
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that the new behaviour makes sense if one is auto-permaviewing or retaining the story list. Maybe the scroll-to-top should occur as before when one isn't.

Failing that, it could be configured by a Control Panel option.

Please sign in to comment.