Matrix inputs: support curly HTML brackets - #1849
Conversation
|
Wow! Thanks @adamant-pwn that's been on my list for a very long time. Thank you for finally sorting this out. |
|
Is the shape of the brackets exposed to the accessibility tree at all? |
The brace wrapper inherited right-to-left direction from the page, so logical inline-start and inline-end placed the unmirrored left brace on the right and the mirrored right brace on the left. Force the mathematical wrapper to remain left-to-right, matching STACK's matrix input contents, and protect the declaration from Moodle's RTL transformation. Apply the same fix to desktop and mobile CSS.
The iss1848 integration branch now includes PR maths#1847, which overlaps the matrix and variable-matrix renderers, API documentation, and tests changed here. Resolve those overlaps by retaining c()/r() CAS value-type support together with the curly-bracket renderer and its API value. This keeps PR maths#1849 conflict-free without rewriting its published history.
Moodle's CSS lint configuration rejects data: URLs, so the embedded SVG mask made the Grunt step fail. Store the brace path as pix/curlybracket.svg instead, reference it through Moodle's qtype_stack pix placeholder in styles.css, and use the equivalent relative URL in the directly served mobile stylesheet. This preserves the current-colour mask and RTL behavior while using Moodle's normal cacheable image pipeline.
|
No; like the existing square, round and bar styles, it is CSS-only. |
Do you have a recommendation with this issue @christianp? |
|
If the brackets were separate elements, instead of styled pseudoselectors, you could add an |
Summary
The question-level
matrixparensoption already accepts{, and STACK's TeX output renders matrices with curly braces. The fixed and variable-size HTML matrix inputs currently fall back to square brackets for that value.This adds a
matrixcurlybracketsstyle and selects it for both input types and their API metadata. The brace is stored as a small STACK plugin SVG and used as a CSS mask, so it scales to the input height while keeping a stable stroke width and inheriting the surrounding text colour. The same rule is included instyles.cssandmobile.css.There is no new question option or migration. Existing square, round, bar and no-bracket rendering is unchanged.
Screenshots
Fixed 2 × 2, fixed 4 × 1 and variable-size inputs rendered by a local patched STACK instance:
The existing square and round choices alongside the new curly rendering:
These were captured from the local STACK API image
2025102100with the patch applied; each widget was produced by the API renderer rather than reconstructed as static HTML.Verification
matrixparens: '{'.