Feature Request: Save Snippet via Keyboard Shortcut (Ctrl + S)

Open Beginner friendly
#14 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript
Domain
frontend

Research direction

Locate the JavaScript entry point that defines saveSnippet() and controls the snippet modal. Trace how the Save Snippet button invokes the form's native validation, then handle Ctrl + S and Cmd + S only while the modal is open. Done means the shortcut saves valid snippets, preserves validation for empty Title, Category, or Code fields, blocks the browser dialog in the modal, and leaves it unchanged elsewhere.

Written by the indexing model from the issue text.

Description

medium SourceSprint '26

⚠️ Competition Only
This issue was created exclusively for participants of SourceSprint'26, an open-source competition held at VIT Vellore.
Pull requests submitted for this issue will only be accepted from registered SourceSprint'26 participants. Pull requests from others will be closed without review.

Description

When adding or editing a snippet in the modal window, users naturally want to press Ctrl + S (or Cmd + S) to save the work. Right now, doing this triggers the browser's default "Save Page As" dialog. We need to intercept this shortcut to save the snippet instead, but only when the modal is open.

Expected Behavior

  • When the snippet modal is open, pressing Ctrl + S or Cmd + S should trigger the saveSnippet() function.
  • The browser's default "Save HTML Page" prompt must be strictly blocked.
  • If the modal is not open, Ctrl + S should be ignored by our script, allowing the standard browser behavior.
  • If the required fields (Title, Category, Code) are empty when the shortcut is pressed, the native form validation should still trigger, exactly as it does when clicking the "Save Snippet" button.
Dominant language
JavaScript
Stars
0
Forks
20
Avg merge
25m
Merged PRs (30d)
3

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from IEEE-VIT/code-block

All issues in IEEE-VIT/code-block

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.