Skip to content
Discussion options

You must be logged in to vote

Thanks, I updated the code. I also tested the key.claim more thoroughly. Hence, I added an early return to not block other button handlers. A blocked F5 button was quite weird to experience. 😅

Also here is a version with switch, which is more similar to the TS code:

keyboard$
    .subscribe(key => {
        // Do nothing when "search" active
        if (key.mode === "search")
            return;
        
        switch (key.type) {
            case "ArrowLeft":
                const prev = document.querySelector("link[rel=prev]");
                if (typeof prev !== "undefined")
                    location.href = prev.href;
                break;
            case "ArrowRight":
          …

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@squidfunk
Comment options

@kamilkrzyskow
Comment options

Answer selected by Lakstoties
@Lakstoties
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants