From f1a93adc1548b4be4d391eb2e092537848568428 Mon Sep 17 00:00:00 2001
From: Vaivaswat <vaivaswat2244@gmail.com>
Date: Thu, 16 Jan 2025 01:47:30 +0530
Subject: [PATCH 1/2] updated keyisDown to work with strings

---
 src/events/keyboard.js | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/events/keyboard.js b/src/events/keyboard.js
index 5b0de949ed..3965120d7b 100644
--- a/src/events/keyboard.js
+++ b/src/events/keyboard.js
@@ -904,6 +904,9 @@ function keyboard(p5, fn){
    */
   fn.keyIsDown = function(code) {
     // p5._validateParameters('keyIsDown', arguments);
+    if (typeof code === 'string' && code.length === 1) {
+      code = code.toUpperCase().charCodeAt(0);
+    }
     return this._downKeys[code] || false;
   };
 

From 7de32b819c000c32f1a30ef6907cf7dcbd6113b6 Mon Sep 17 00:00:00 2001
From: Vaivaswat <vaivaswat2244@gmail.com>
Date: Thu, 16 Jan 2025 02:01:07 +0530
Subject: [PATCH 2/2] added the inline documentation for updated keyisDown

---
 src/events/keyboard.js | 39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/src/events/keyboard.js b/src/events/keyboard.js
index 3965120d7b..b5a2dfcdb7 100644
--- a/src/events/keyboard.js
+++ b/src/events/keyboard.js
@@ -901,7 +901,44 @@ function keyboard(p5, fn){
    * }
    * </code>
    * </div>
-   */
+   * <div>
+  * <code>
+  * let x = 100;
+  * let y = 100;
+  * 
+  * function setup() {
+  *   createCanvas(200, 200);
+  *   textSize(16);
+  * }
+  * 
+  * function draw() {
+  *   background(220);
+  *   
+  *   // Move left/right with A/D keys
+  *   if (keyIsDown('a')) {
+  *     x -= 5;
+  *   }
+  *   if (keyIsDown('d')) {
+  *     x += 5;
+  *   }
+  *   
+  *   // Move up/down with W/S keys
+  *   if (keyIsDown('w')) {
+  *     y -= 5;
+  *   }
+  *   if (keyIsDown('s')) {
+  *     y += 5;
+  *   }
+  *   
+  *   // Draw circle at current position
+  *   circle(x, y, 50);
+  *   
+  *   // Display instructions
+  *   text('Use WASD keys to move', 20, 20);
+  * }
+  * </code>
+  * </div>
+  */
   fn.keyIsDown = function(code) {
     // p5._validateParameters('keyIsDown', arguments);
     if (typeof code === 'string' && code.length === 1) {