Feed tree sidebar unrequested scrolling

Development-related discussion, including bundled plugins
User avatar
gmargo
Bear Rating Disaster
Bear Rating Disaster
Posts: 62
Joined: 08 Jan 2012, 22:33
Location: Silicon Valley

Feed tree sidebar unrequested scrolling

Postby gmargo » 01 Feb 2012, 18:32

I've been using keys n and p to navigate down and up the article list
within a particular feed. Often when I hit a key, the feed list in
the sidebar does a scrolling action. Since my feed list is long
enough to require a slider, an unexpected scrolling action is obvious
and quite annoying.

I finally tracked down the problem that causes this: keystrokes are
being interpreted twice. Once by the normal tt-rss.js logic, and once
by the dijit.Tree widget that controls the feed list.

It seems that dijit.Tree "helps" us by performing keyboard searching on the
list. It's actually moving the focus on the tree, and performs the
"unrequested scrolling" if the focused-to node is off the screen.
http://dojotoolkit.org/reference-guide/ ... -searching

So when I hit an 'n' key, the list would scroll to the "Newegg" entry
in my feed list. And when I hit a 'p' key, the list would scroll to
one of many feed entries about Perl, and subsequent 'p' keys would
rotate through all the Perl feed entries in the list.

To make a long story short, to prevent dijit.Tree from unnecessarily
interpreting those keys, I patched FeedTree.js to capture and ignore
keystrokes. This solves my problem, and I can't see any bad side
effects, but there may be a better way to do it.

Code: Select all

--- a/js/FeedTree.js
+++ b/js/FeedTree.js
@@ -94,6 +94,9 @@ dojo.declare("fox.FeedStoreModel", dijit.tree.ForestStoreModel, {
 });
 
 dojo.declare("fox.FeedTree", dijit.Tree, {
+   _onKeyPress: function(/*Event*/ e){
+      return; // Stop dijit.Tree from interpreting keystrokes
+   },
    _createTreeNode: function(args) {
       var tnode = new dijit._TreeNode(args);
 

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: Feed tree sidebar unrequested scrolling

Postby fox » 02 Feb 2012, 12:40

Good idea, fixed in trunk. Thanks.


Return to “Development”

Who is online

Users browsing this forum: No registered users and 4 guests