Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yak.functions.pageUp scrolls too much on wiki.archlinux.org #5

Open
wh5a opened this issue Jan 26, 2010 · 13 comments
Open

yak.functions.pageUp scrolls too much on wiki.archlinux.org #5

wh5a opened this issue Jan 26, 2010 · 13 comments

Comments

@wh5a
Copy link

wh5a commented Jan 26, 2010

Pick a long page, say
http://wiki.archlinux.org/index.php/Get_All_Mouse_Buttons_Working,
press C-v with Emacs shortcuts enabled, and you'll find it scrolls too
much.

@decklin
Copy link
Owner

decklin commented Jan 26, 2010

pageup/pagedown, space/backspace, and C-v/M-v all scroll the same amount for me on that page. Do you have a different font size set? As it mentions in base.js the overlap for scrolling by pages is 40 pixels but should actually scale with the zoom setting, but I don't think you mean that.

@wh5a
Copy link
Author

wh5a commented Jan 26, 2010

On my system pagedown and C-v doesn't scroll the same amount. No zoom applied. Probably we have different fonts.

The Smooth Gestures extension (https://chrome.google.com/extensions/detail/lfkgmnnajiljnolcgolmmgnecgldgeld) scrolls less than pagedown, but at least it doesn't skip anything.

@decklin
Copy link
Owner

decklin commented Jan 26, 2010

So, it scrolls more than a page? That must be a different problem, because scrollPages does

var distance = Math.abs(n) * window.innerHeight - lineHeight;

i.e. it would only be more than the height of the window (given n = 1) if lineHeight were negative, or if window.innerHeight were somehow greater that the actual visible height. Really not sure what's going on.

@wh5a
Copy link
Author

wh5a commented Jan 26, 2010

Yes, it scrolls more than a page.

@decklin
Copy link
Owner

decklin commented Jan 26, 2010

By how much?

@wh5a
Copy link
Author

wh5a commented Jan 26, 2010

I don't know how to describe it. About four lines more.

Is it possible to programmatically simulate a key in Javascript? Because the current approach doesn't work well on some javascript-heavy sites. Test C-v/C-n on Google Reader and you'll see what I mean.

@wh5a
Copy link
Author

wh5a commented Jan 26, 2010

One more website that breaks: GMail. Doesn't react to C-v/C-n/etc. at all.

@decklin
Copy link
Owner

decklin commented Jan 26, 2010

I'm thinking about just adding a global blacklist for this. I don't use Google Reader or GMail but i get the impression that if I did I'd want to use their keyboard shortcuts while on those sites and not my own. But I'm getting off topic for this bug...

@wh5a
Copy link
Author

wh5a commented Jan 27, 2010

IMO it's better not to have blacklists. It creates an inconsistent user experience, and makes me wonder for a few seconds every time the shortcuts are not working.

And the Emacs keybindings don't conflict with Google's built-in shortcuts at all, so there's no need to blacklist them. In gmail's case, I suppose GMail clears all the event listeners, making your shortcuts not working. In greader's case, the shortcuts are working but scrolling the page incorrectly (it's hard to explain, better to try it yourself). That's why I wanted to know if there's a way to simulate keystrokes. For example, when users press C-v, generates a keydown event of pagedown. If Javascript's capability is limited, maybe we can let yakserver do this...

@decklin
Copy link
Owner

decklin commented Jan 27, 2010

I'll remove gmail/reader from the default blacklist then and look for a better solution. Someone else still might want to use it for something, though.

@wh5a
Copy link
Author

wh5a commented Feb 9, 2010

After looking into this issue more, Chrome seems to report a wrong value of window.innerHeight. It's even larger than window.outerHeight. I suppose this isn't your fault and may be specific to my machine's configurations.

Anyway, I patched Webkit to support Firefox's scrollByPages function, which is ideal for your extension. Of course you'd have to recompile Chromium yourself. I cannot think of a better way. My patch is at http://github.com/wh5a/arch/blob/master/archpkg/chromium-browser-svn/dom-scroll-pages.patch if you're interested.

@decklin
Copy link
Owner

decklin commented Feb 9, 2010

I could do that, but I couldn't reasonably ask everyone who installs the extension to do that :-/

Hopefully the Chromium team can consider including your patch (I'd like to be able to use it) and determine why window.innerHeight is wrong for you. In case anyone else is having the same problem, it would be great if you could add a link to the bug reports for those here.

@wh5a
Copy link
Author

wh5a commented Feb 9, 2010

I don't know... Since I patched Webkit I think Chromium's policy is for me to submit the patch to the Webkit team. They may reject my patch if window.scrollByPages is a non-standard function. Too much hassle for me :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants