pretext icon indicating copy to clipboard operation
pretext copied to clipboard

Bind arrow keys to navigation

Open Alex-Jordan opened this issue 2 years ago • 4 comments

It would be nice if I could keyboard navigate to the "Next" page with the right arrow key, etc.

I would try adding this feature myself, but I'm afraid there are too many moving parts with JS in script tags, JS from JS Core, and React.

Alex-Jordan avatar Sep 14 '23 20:09 Alex-Jordan

Good idea.

But, total speculation: what if some interactive (like MathJax Explorer) wanted that key also and had the focus?

rbeezer avatar Sep 14 '23 21:09 rbeezer

The behavior of the key should be that of the interactive thingy if focus is within that thingy.

In normal webpage use, the up/down arrow keys will scroll the page up and down. Now imagine some element is tall, but constrained in height, and has overflow:scroll. When focus gets inside that thing, up/down changes to scrolling up and down within that thing. So I reckon it should be a bit like this when something smaller wants the left/right keys too.

Here are some relevant opinions: https://ux.stackexchange.com/questions/59643/is-it-okay-to-map-the-left-right-arrow-keys-to-a-websites-navigation

I do find that sometimes a table in PTX is rigidly too wide for a small screen, and horizontal scrolling comes into play. And then there would be conflict between using left/right for that scrolling and for page navigation.

Alex-Jordan avatar Sep 14 '23 22:09 Alex-Jordan

The behavior of the key should be that of the interactive thingy if focus is within that thingy.

In normal webpage use, the up/down arrow keys will scroll the page up and down. Now imagine some element is tall, but constrained in height, and has overflow:scroll. When focus gets inside that thing, up/down changes to scrolling up and down within that thing. So I reckon it should be a bit like this when something smaller wants the left/right keys too.

Just to make sure that any such navigation doesn't mess up slides, which inherit some conversion stuff from html - presumably js as well? The way that is supposed to work is inherited from reveal.js right, as far as I have observed.

Message ID: @.***>

kcrisman avatar Sep 15 '23 00:09 kcrisman

A more conventional case: typing in any kind of input field, the arrow keys should do their usual thing, not take you to a new page.

Alex-Jordan avatar Sep 15 '23 05:09 Alex-Jordan