erkyrath / glkote

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

Escape key works inconsistently between Safari and Chrome #67

Open erkyrath opened 1 year ago

erkyrath commented 1 year ago

Noted in this thread: https://intfiction.org/t/release-along-with-parchment-interpreter/61411/20

Testing in https://eblong.com/zarf/glulx/quixe/quixe/play-remote.html?story=stories/Advent.ulx.js : If the input focus is off the input line, hitting a normal key (e.g. space bar) refocuses and enters the key. Does escape do the same? Yes in Safari, no in Chrome.

Same problem with the delete key, now that I check.

This becomes noticeable in keystroke input. (Type HELP for example.) Hitting escape should quit the help menu, but this breaks in Chrome if the input focus has come loose. It's a little shaky even in Safari, where you may have to hit escape twice.

curiousdannii commented 1 year ago

GlkOte only has a keypress document handler, so it's not going to be able to detect non-character keys!

Also, after focusing you may have to retrigger keydown events. Here's how I did it in AsyncGlk: https://github.com/curiousdannii/asyncglk/blob/073f4c49218e13b71ee19f8729a6dd81ee76c23d/src/glkote/web/windows.ts#L787