From a96b86778faa30daeddd76ab75ebe76ea276d0af Mon Sep 17 00:00:00 2001
From: Robert Wolff <mahlzahn@posteo.de>
Date: Thu, 11 Jul 2024 18:32:52 +0200
Subject: [PATCH] fix unchecking check boxes like [X]

---
 web_src/js/markup/tasklist.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/web_src/js/markup/tasklist.js b/web_src/js/markup/tasklist.js
index a40b5e4abd..375810dc2f 100644
--- a/web_src/js/markup/tasklist.js
+++ b/web_src/js/markup/tasklist.js
@@ -32,11 +32,11 @@ export function initMarkupTasklist() {
         const buffer = encoder.encode(oldContent);
         // Indexes may fall off the ends and return undefined.
         if (buffer[position - 1] !== '['.codePointAt(0) ||
-          buffer[position] !== ' '.codePointAt(0) && buffer[position] !== 'x'.codePointAt(0) ||
+          buffer[position] !== ' '.codePointAt(0) && buffer[position] !== 'x'.codePointAt(0) && buffer[position] !== 'X'.codePointAt(0) ||
           buffer[position + 1] !== ']'.codePointAt(0)) {
           // Position is probably wrong.  Revert and don't allow change.
           checkbox.checked = !checkbox.checked;
-          throw new Error(`Expected position to be space or x and surrounded by brackets, but it's not: position=${position}`);
+          throw new Error(`Expected position to be space, x or X and surrounded by brackets, but it's not: position=${position}`);
         }
         buffer.set(encoder.encode(checkboxCharacter), position);
         const newContent = new TextDecoder().decode(buffer);