Browse, saved scripts, Output view, report and Model guide — build .120

Browse, saved scripts, Output view, report and Model guide — build .120

Build .120 fixes what the audit of the calculator’s non-statistical pages found. Code:

  • Browse: commitCell, addRows and cmdText in src/app/component.js, and src/browse-scroll.js / .css;
  • the saved scripts: scriptHead in component.js, and cpDoFileText in src/console-page.js;
  • src/output-view.js / .css;
  • the report’s esc in component.js;
  • src/model-guide.js.

Browse (the Data Editor)

  • A numeric cell takes numbers only, as in Stata’s Data Editor.
    • Before, one stray word (or a decimal comma) silently turned the whole variable into text.
    • Now a decimal comma (3,5) is read as 3.5.
    • Anything else that is not a number (abc, 0x1A) is refused with a message. The old value is put back and the cursor stays on the cell.
    • To store text, change the variable to text first.
  • Every edit reaches the do-file, the R script, the Output view and the report appendix:
    • an edited value: replace age = 3.5 in 1 / df$age[1] <- 3.5;
    • a missing value: . / NA;
    • text: "Luisa";
    • added rows: set obs N.

    Before, edits recorded undo only, so later results depended on changes the scripts did not have.

  • Clicking a cell selects its value, so typing replaces it, as in a spreadsheet. Click again to place the cursor inside the value.
  • Escape puts the old value back and keeps the cursor on the cell. Before, it dropped focus to the page.
  • Tab or Enter where there is no cell to move to lets focus leave the grid. Before, the keystroke was swallowed.
  • Tabs pressed faster than the screen repaints move on from where the last one went. Before, three quick Tabs could land one column short.
  • Screen readers get a grid:
    • the container is role="grid";
    • each input sits in a gridcell;
    • each column header stays a button inside its columnheader.

    The wrappers use display: contents, so the layout is unchanged.

Saved scripts

  • The console page’s Save do-file / Save script starts with the same header as File → Save do-file: the line that reads the data (use / import delimited / read_dta) and the missing-code lines (mvdecode). Before, it could not run on its own.
  • A typed command that ran with the active weight is saved as it ran (summarize y [aw=w]), so the do-file gives the page’s numbers. In the R script, a line the page weighted but R runs unweighted says so in a comment.

Output view

  • A command the page cannot run shows its error under the command box (. xyz_bogus 1 — Unknown command). Before, nothing appeared.
  • “Click to run again” works from the keyboard: Tab to the line, then Enter or Space.
  • A chart no longer repeats the command line just logged for it. This removes the double histogram line with a weight.

Report and print view

  • Figure titles are escaped for quotes as well, so a title with " no longer breaks the image description, and a crafted title cannot inject markup.
  • The report header says “GM 26.11”, like the do-file and the lab report.
  • A search word matches the start of a word. “chi” finds chi-square, not “machine” or “which”.
  • Entries whose title or aliases match come first.
  • Common Spanish terms find their English entries, for example:
    • regresión → regression;
    • correlación → correlation;
    • medias → means;
    • encuesta → survey;
    • supervivencia → survival;
    • prueba → test.

Validation

  • tests/audit120.test.mjs covers:
    • numeric cells and their do-file / R lines;
    • the grid roles;
    • the saved-script header and weights;
    • the Output view error and keyboard rerun;
    • quote escaping;
    • the guide search.
  • tests/browse-scroll.test.mjs and tests/buttons.test.mjs were updated for the new behaviour.
  • The Browse, File menu, Data edit, Reload, Descriptives and Settings browser suites pass.
  • In Chromium:
    • typing over 43 gives 11;
    • Escape restores the value and keeps focus;
    • xyz in a numeric cell is refused and the old value shown.

Not in this build

The Clicker findings (sign-in, rules, privacy on shared devices, the projector’s results screen, CSV injection, re-joins, reopen after reveal, accessibility) are deferred to a later build at the owner’s request.