Skip to content

Conversation

@surajgojanur
Copy link
Contributor

Changes

Configuration

  • Added ShortcutConfig.js to define shortcuts per algorithm.

UI

  • Added a keyboard icon to the top-right controls.
  • Added a Shortcuts tab to the help modal.
  • Added a focus highlight effect (.shortcut-highlight).
  • Improved UX:
    • Modal closes when clicking outside of it.
    • Keyboard icon toggles the modal correctly.

Logic

  • Implemented a global keydown listener in AlgoSection.js that respects the active algorithm’s shortcut configuration.
  • Avoids triggering shortcuts when:
    • inputs are focused
    • modifier keys are pressed (Ctrl/Cmd/Alt)

Integration

  • Updated BST.js, AVL.js, LinkedList.js, and ArrayList.js to mark inputs as shortcut targets.

Verification

Automated Tests

N/A — relies on browser interaction events (best verified manually).

Manual Verification

  1. Open the app and navigate to one of:
    • BST, AVL, LinkedList, ArrayList
  2. Test shortcuts:
    • i → focus Insert input (or Add Value)
    • d → focus Delete input (or Remove Index)
    • f → focus Find input (BST/AVL only)
    • ? → toggle help modal and show Shortcuts tab
    • Ctrl+/ → toggle help modal and show Shortcuts tab
  3. Test UI:
    • Click the keyboard icon in the top-right.
    • Verify the Shortcuts tab lists shortcuts for the current page.
  4. Safety checks:
    • While typing in an input, pressing i/d/f/? should type normally (no shortcut triggers).
    • Pressing Ctrl+i, Alt+i, or Cmd+i should not trigger shortcuts.

Supported Algorithms

  • Binary Search Tree (BST)
  • AVL Tree
  • Singly Linked List
  • Array List

@surajgojanur surajgojanur force-pushed the feature/keyboard-shortcuts branch from 0ee36de to e35f59a Compare February 8, 2026 07:23
@surajgojanur
Copy link
Contributor Author

Untitled design

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant