erkyrath / glkote

A Javascript display library for IF interfaces
http://eblong.com/zarf/glk/glkote.html
MIT License
26 stars 11 forks source link

On Firefox, scrolling keys don't work when input is focused #81

Open JoshuaGrams opened 1 week ago

JoshuaGrams commented 1 week ago

At least Firefox 131.0.3 on Windows, for me.

It's not clear to me yet why this is happening.

This code in evhan_doc_keypress talks about scrolling keys, but AFAICT it's both dead code and wrong code because 1) it's in a keypress event, which doesn't get non-printable key events (and I think never has? IIRC that was always one of its main weaknesses), and 2) it treats keycodes as if they're ASCII, which they aren't entirely (the logic here for "is this a printable key" is keycode >= 32 && keycode <= 126 but PageUp, PageDown, End, and Home are 33-36, respectively).

From messing around in the debugger it looks like these keys only pass through evhan_input_keydown and then the scrolling happens (on Chrome) after that event handler returns but I'm not yet sure why it doesn't happen on Firefox. I'll keep looking, but I wanted to file an issue in case it's an obvious fix for someone else...

erkyrath commented 1 week ago

Ah, this is what we were chatting about last night.

Thanks for digging into it. Yes, I see the same problem on Mac Firefox.