Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-GFM-021

Clicking a checkbox toggles one source character

When a writer clicks a checkbox in reading or edit mode, the extension SHALL edit only the character between its brackets, without opening a block editor, and revert the checkbox and show the reason next to it for a few seconds (and as its tooltip) when the host refuses the toggle; the host SHALL accept a previewCheckboxToggle message only with a safe non-negative integer column, a boolean checked state and a single line.

Step 2 of path 1 in StRS-MDOKFSTUDIO-GFM-003: from “The task shows a checkbox” to “The source holds [x] for the task”.

Scenarios 8

The situations the tests check; open one to read it.

nominalToggle in reading mode
Givena trusted preview with '- [ ] a'
Whenthe checkbox is clicked
Thenthe source becomes '- [x] a' and no block editor opens
nominalToggle in a table cell in edit mode
Givenedit mode and '[ ]' in a table cell
Whenthe checkbox is clicked
Thenonly that character changes and no block editor opens
boundaryUppercase marker rewritten
Givena checked '[X]' marker
Whenthe checkbox is clicked to uncheck and clicked again to check
Thenthe marker is written back as lowercase '[x]'
refusalClicks that send no message
InputOutcome
a click while a toggle awaits the host resultonly one toggle message was sent and the checkbox is aria-busy until the result arrives
a checkbox without valid line or column attributesthe click is prevented and no message is sent
refusalThe host refuses the toggle

For the open editor and the stale render, see SwRS-MDOKFSTUDIO-BLOCK-041, SwRS-MDOKFSTUDIO-TRUST-065 and SwRS-MDOKFSTUDIO-TRUST-005. The reasons of the toggle are:

InputOutcome
a toggle refused as out of datethe checkbox returns to its previous state, and the tooltip and a short status note next to the box read 'The preview is out of date. Try again once it has refreshed.'
a toggle for a marker removed from the sourcerefused with 'The checkbox is no longer in the source. Refresh the preview.'
a toggle while a Markdown edit is openrefused with 'Save or cancel the open Markdown edit before toggling a checkbox.'
VS Code fails to apply the editrefused with 'VS Code could not apply the checkbox edit.' or the edit error
a file VS Code keeps read-only (files.readonlyInclude, or read-only in the session): the apply resolves and changes nothingrefused with 'This file is read-only in VS Code.'
a toggle message the validator rejects (scenario 'Invalid toggle messages')refused with 'The checkbox request was not understood. Refresh the preview.'

The reason appears in a status note right after the box and disappears after about six seconds; a second refusal of the same box replaces the note.

boundaryContent patches clear pending toggles
InputOutcome
a pending toggle of old content, then an in-place patch and the old resultthe new content checkbox is unchanged
no pending toggle, then a patchpatching succeeds without effect on checkboxes
refusalInvalid toggle messages

A previewCheckboxToggle message with line 3, endLine 3, column 4, checked true is accepted. Column, checked and radioGroup are accepted on no other message type: a previewEditCancel message with column 4, or a previewScroll message with a radioGroup, is refused.

InputOutcome
a negative columnrejected, no edit is made
a fractional columnrejected, no edit is made
a checked state that is not a booleanrejected, no edit is made
line different from endLinerejected, no edit is made
a radioGroup (the options of a radio choice) that is not an array of 2 to 256 distinct line and column positions including the message's own, or that comes with checked falserejected, no edit is made
refusalA rejected message is answered
InputOutcome
a rejected toggle that names the shown document, a render and an edit idthe page is answered with the error 'The checkbox request was not understood. Refresh the preview.' and no edit is made, so the box does not stay busy
a rejected toggle without an edit id, or for another documentdropped without an answer

Implemented in 6

Tested by 8

Replaces

SwRS-MDOKFSTUDIO-GFM-023A pending toggle blocks further clicks superseded superseded by SwRS-MDOKFSTUDIO-GFM-021 Markdown file
SwRS-MDOKFSTUDIO-GFM-024A refused toggle reverts the checkbox with a reason superseded superseded by SwRS-MDOKFSTUDIO-GFM-021 Markdown file
SwRS-MDOKFSTUDIO-GFM-027The host validates checkbox toggle messages superseded superseded by SwRS-MDOKFSTUDIO-GFM-021 Markdown file
SwRS-MDOKFSTUDIO-GFM-028Content patches clear pending toggles superseded superseded by SwRS-MDOKFSTUDIO-GFM-021 Markdown file