A UX pass over the workspace, and two defects it turned up
Walking the site as a student (desktop, a phone-width screen, dark) found these. Each is small; together they are what got in the way. Defects: - Opening a problem in the Bridge saved the generated Mojo over the exercise's own program. The workspace fills every pane's editor as it opens, the editor reported that as typing, and the Bridge's read-only Mojo pane holds the generated text. Developer then showed generated Mojo labeled "your edits", and the problem counted as edited. The value setter now marks its change as a load, the change listener leaves loads out, and a Bridge session refuses a Mojo edit. - A page opened at #/#problems or #/#reference stopped about 45px past the heading: the fonts arrived after the place was computed. A page built this moment goes straight to its section and finds it again when the fonts are in; a page already on screen still scrolls there. The workspace: - With no run to step, the Run view said "Nothing to run yet." It and the stepper now give one reason (src/core/norun.ts): how many problems the stepped pane has and the first with its line, with a button to the line and the Problems list; or that the pane is empty. - In the Bridge the dock starts at about a quarter of the height (it holds a call, a line of output, a short list), so the code and the run get the room. Developer keeps a third for the compiler's answer. A double-click on a divider returns to the area's default, not to the student's last position. - The reason a pane is not in step wraps instead of ending in an ellipsis, and a button in the pane's head keeps its words on one line. - A problem that does not exist keeps the site's navigation and links the problem list. - Help, the theme switch and the stepper's first, back, step and last buttons have names a screen reader can say. A phone-width screen: - The toolbar is three rows in every area and on every tab (it was four or five): the mark, the area, help and the theme; the problem, Versions and Reset; the actions. About 30px more of the code shows. An embedded workspace keeps its own toolbar. - The Share dialog puts each row's name above what it holds (a note had been squeezed to a word per line), and the Versions menu opens across the screen instead of running off its right edge. - The stepper's speed label stays with its slider. Checked by hand, in headless Chromium at 1440x900, 1366x768, 390x844 and 320x640, light and dark: each state above before and after; the editor has line numbers and highlighting; the stepper steps; embeds (playground, trace, Developer) are unchanged; 31 smoke scenarios clean but the ones that err on purpose.
This commit is contained in:
14 files changed
+302
-39
No files matched your search
+26
-5
@@ -12,6 +12,7 @@ import { parseRoute, decodeState, loadLocal, migrateLocal, type PlayState, embed
|
||||
import { takeCrashed, settle, setAside, markBusy } from './core/guard.js';
|
||||
import { notice, messagePage } from './ui/notice.js';
|
||||
import { homeView } from './ui/home.js';
|
||||
import { siteNav } from './ui/nav.js';
|
||||
import { quartoView } from './ui/quarto.js';
|
||||
import { libraryView } from './ui/library.js';
|
||||
import { libraryState } from './core/library.js';
|
||||
@@ -76,9 +77,23 @@ async function stateForRoute(): Promise<Resolved> {
|
||||
return null;
|
||||
}
|
||||
|
||||
function scrollToAnchor(): void {
|
||||
/**
|
||||
* Bring the section the address names to the top. On a page already on screen the move is shown (`built` false).
|
||||
* A page built this moment is still waiting for its fonts, and when they arrive the text above the section changes
|
||||
* height: a move started before that ends short of the heading or past it. So there the page goes straight to the
|
||||
* section, and once more when the fonts are in, unless the reader has gone elsewhere by then.
|
||||
*/
|
||||
function scrollToAnchor(built = false): void {
|
||||
const m = /#(problems|reference|quarto-teaser)$/.exec(location.hash) ?? /^#\/quarto#([\w-]+)$/.exec(location.hash);
|
||||
if (m) requestAnimationFrame(() => document.getElementById(m[1])?.scrollIntoView({ behavior: 'smooth', block: 'start' }));
|
||||
if (!m) return;
|
||||
const go = (behavior: ScrollBehavior) => document.getElementById(m[1]!)?.scrollIntoView({ behavior, block: 'start' });
|
||||
if (!built) { requestAnimationFrame(() => go(matchMedia('(prefers-reduced-motion: reduce)').matches ? 'auto' : 'smooth')); return; }
|
||||
const hash = location.hash;
|
||||
requestAnimationFrame(() => {
|
||||
go('auto');
|
||||
const at = window.scrollY;
|
||||
void document.fonts?.ready.then(() => { if (location.hash === hash && Math.abs(window.scrollY - at) < 200) go('auto'); });
|
||||
});
|
||||
}
|
||||
|
||||
/** In a host page (the Quarto extension's pplus.js), follow its light/dark switch: the host posts
|
||||
@@ -125,11 +140,17 @@ async function show(): Promise<void> {
|
||||
add(app, messagePage('That link did not open', String(e?.message || e)));
|
||||
return;
|
||||
}
|
||||
if (resolved && 'missing' in resolved) { add(app, messagePage(resolved.missing.title, resolved.missing.text)); document.title = `${resolved.missing.title} · Programming+`; return; }
|
||||
if (resolved && 'missing' in resolved) {
|
||||
// in the app the page keeps the site's navigation and offers the problem list; an embed is somebody's page, so it says what is missing and no more
|
||||
const inApp = route.kind !== 'embed';
|
||||
const page = messagePage(resolved.missing.title, resolved.missing.text, ...(inApp ? [el('a', { class: 'btn btn-primary', href: '#/#problems' }, 'Browse the problems')] : []));
|
||||
if (inApp) page.insertBefore(siteNav('home'), page.firstChild);
|
||||
add(app, page); document.title = `${resolved.missing.title} · Programming+`; return;
|
||||
}
|
||||
if (!resolved && route.kind === 'library') { add(app, libraryView(route.id)); document.title = `${route.id ? `${route.id} · ` : ''}Library · Programming+`; window.scrollTo(0, 0); return; }
|
||||
if (!resolved && route.kind === 'quarto') { add(app, quartoView()); document.title = 'With Quarto · Programming+'; if (route.anchor) scrollToAnchor(); else window.scrollTo(0, 0); return; }
|
||||
if (!resolved && route.kind === 'quarto') { add(app, quartoView()); document.title = 'With Quarto · Programming+'; if (route.anchor) scrollToAnchor(true); else window.scrollTo(0, 0); return; }
|
||||
if (!resolved) {
|
||||
add(app, homeView()); document.title = HOME_TITLE; scrollToAnchor();
|
||||
add(app, homeView()); document.title = HOME_TITLE; scrollToAnchor(true);
|
||||
if (isUnknownRoute(location.hash)) notice('There is no page at that address, so this is the home page. Links from before the three areas open here too.');
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user