simon-git: puzzles (main): Ben Harris

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Wed Nov 23 23:13:51 GMT 2022


TL;DR:
  52cd580 js: Add keyboard navigation for menus
  8445f07 js: Replace :focus-within with JS-maintained .focus-within
  2d439dd js: Move focus-tracking to entirely "focus" events
  e792703 js: Move global keyboard handler to capturing phase
  b5ccb0c js: Add actions for more keys in menus

Repository:     https://git.tartarus.org/simon/puzzles.git
On the web:     https://git.tartarus.org/?p=simon/puzzles.git
Branch updated: main
Committer:      Ben Harris <bjh21 at bjh21.me.uk>
Date:           2022-11-23 23:13:51

commit 52cd58043ac144eeafb92fd962662420506283c1
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=52cd58043ac144eeafb92fd962662420506283c1;hp=b1b2da98961c3ec6561a934834026c117f4366d3
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Sat Nov 12 23:39:05 2022 +0000

    js: Add keyboard navigation for menus
    
    Once the input focus is in the menu system (for instance by Shift+Tab
    from the puzzle), you can move left and right through the menu bar and
    up and down within each menu.  Enter selects a menu item.  The current
    menu item is tracked by giving it the input focus.

 emcclib.js     |  1 +
 emccpre.js     | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 html/jspage.pl | 12 ++++----
 3 files changed, 97 insertions(+), 5 deletions(-)

commit 8445f07827eb13db005aa38b7f665f8154e3918c
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=8445f07827eb13db005aa38b7f665f8154e3918c;hp=52cd58043ac144eeafb92fd962662420506283c1
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Mon Nov 14 22:16:03 2022 +0000

    js: Replace :focus-within with JS-maintained .focus-within
    
    Old browsers (like KaiOS 2.5) don't have :focus-within, but it's pretty
    easy to replace the pseudo-class with a real .focus-within class
    maintained by JavaScript event handlers.  This is made only marginally
    fiddlier by the odd fact that "focus" and "blur" events don't bubble.

 emccpre.js     | 19 +++++++++++++++++++
 html/jspage.pl |  4 ++--
 2 files changed, 21 insertions(+), 2 deletions(-)

commit 2d439dd00ed41c697a917c7445e143ae10ff5e74
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=2d439dd00ed41c697a917c7445e143ae10ff5e74;hp=8445f07827eb13db005aa38b7f665f8154e3918c
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Sat Nov 19 16:30:28 2022 +0000

    js: Move focus-tracking to entirely "focus" events
    
    When we disable a button, it loses focus but doesn't generate a "blur"
    event.  This means our "focus-within" class goes wrong.  Instead of
    relying on "blur" events to remove the class, remove it from any
    inappropriate elements in the "focus" handler.  This requires attaching
    the handler to the root element of the document, but I've got plans that
    need that anyway.

 emccpre.js | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

commit e79270368b709a7cceb593767b1d0ac9aa9a311f
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=e79270368b709a7cceb593767b1d0ac9aa9a311f;hp=2d439dd00ed41c697a917c7445e143ae10ff5e74
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Tue Nov 15 22:17:33 2022 +0000

    js: Move global keyboard handler to capturing phase
    
    In the bubbling phase it managed to catch the "Enter" keypress that
    opened a dialogue box from the menu and use it to close the dialogue
    box again.  I think it's probably reasonable to have it run earlier and
    just permanently steal any keypresses it wants.

 emccpre.js | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

commit b5ccb0c9afb17a566b0be172737cac1147ea2d8b
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=b5ccb0c9afb17a566b0be172737cac1147ea2d8b;hp=e79270368b709a7cceb593767b1d0ac9aa9a311f
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Wed Nov 23 22:27:54 2022 +0000

    js: Add actions for more keys in menus
    
    I expect Escape to exit the menu, and SoftRight should do that as well
    for KaiOS.  Backspace goes up one level through the menus, again because
    that's conventional on KaiOS and not too confusing elsewhere.

 emccpre.js | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)



More information about the tartarus-commits mailing list