Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-GFM-041

Choosing an option moves the (x)

When a writer clicks or presses Space or Enter on an unselected option of a radio group, the extension SHALL write '(x)' on that option and '( )' on the previously selected one as one undo step, and restore the previous selection with the reason next to the option when the host refuses the choice.

Step 2 of path 1 in StRS-MDOKFSTUDIO-GFM-005: from “The items are shown as a radio group” to “The chosen option is selected”.

Scenarios 3

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

nominalA click moves the selection in the source
Givena trusted preview of '- (x) A', '- ( ) B', '- ( ) C'
Whenthe writer clicks the control of C, in reading or edit mode
Thenthe preview shows C selected at once, the source becomes '- ( ) A', '- ( ) B', '- (x) C' (one character on each of two lines), one undo in the text editor restores the source, and no block editor opens
boundaryClicks and keys that write nothing or normalise
InputOutcome
a click on the only selected optionno message, no write
two '(x)' in the source, then a click on one optionone write that leaves '(x)' on the clicked option only
ArrowDown or ArrowRight, ArrowUp or ArrowLeft, Home, End on a focused optionthe focus moves to the next, previous (wrapping), first or last option of the group, which becomes its tab stop; nothing is written or selected
Space or Enter on a focused optionselects it and writes, as a click does; the key neither scrolls the page nor reaches the block keys; after the choice, once the content patch is applied, the focus is on the option of the same source line and column (also after a click), without scrolling
a content patch (an external rewrite) while no option has the focusno option takes the focus
a click while a choice of the group waits for the hostprevented, no second message
an option without a valid line or column, or a group of fewer than two optionsprevented, no message
refusalAn open editor and refused choices

The choice takes the path of the checkbox toggle (SwRS-MDOKFSTUDIO-GFM-021): the same message type with the group's options, the same gates (SwRS-MDOKFSTUDIO-TRUST-005, SwRS-MDOKFSTUDIO-TRUST-065, SwRS-MDOKFSTUDIO-BLOCK-041), the same answer and the same refusal note.

InputOutcome
a click while a block or frontmatter editor is openthe guard runs on the press (mousedown, capture phase), before the editor's blur: the press is prevented, so the focus and the caret stay in the editor, nothing is committed and the editor stays open; the click that follows sends no message; the editor status reads 'Save or cancel this edit before choosing an option.'
a choice that reaches the host while a Markdown edit is openrefused with 'Save or cancel the open Markdown edit before choosing an option.'
a group whose lines no longer start with a radio marker at their columnsrefused with 'The choice is no longer in the source. Refresh the preview.'
a group whose positions are not one run of consecutive radio items of one list in the current source (lines out of order, items of different indentation or list markers, or a blank line, another item, a heading, a thematic break or a code fence between two options)refused with 'The choice is no longer in the source. Refresh the preview.', and no marker of another group changes
a file VS Code keeps read-only (files.readonlyInclude, or read-only in the session)the apply resolves and changes nothing: refused with 'This file is read-only in VS Code.'
a radio group in the message that is not 2 to 256 distinct positions including the clicked one, or a choice with checked false (see SwRS-MDOKFSTUDIO-GFM-021)refused with 'The checkbox request was not understood. Refresh the preview.'
any refusalthe previous selection and tab stop come back, and the reason shows next to the clicked option for about six seconds and as its tooltip

Implemented in 6

Tested by 6

Replaces

SwRS-MDOKFSTUDIO-GFM-039Radio choice lists render as a radio group and a click moves the selection in the source superseded superseded by SwRS-MDOKFSTUDIO-GFM-040, SwRS-MDOKFSTUDIO-GFM-041 Markdown file