fix(ui): flat readable document, ~3s pacing, skip + replay controls

Argon review of the live page (2026-11-13) called the current experience
unshippable on three counts: a ~1.5s blank start, the CV locked in a 70vh
inner-scroll box (77% hidden on desktop, ~11% visible on a phone), and no
way out of a ~10s animation. Changes:

- document scrolls normally: #content is a flex row with natural height and
  the code pane is position:sticky (verified sticky at scrollY 400/1200 and
  releasing at the container end); the resume has no nested scrollbar, so
  Ctrl+F, selection and native print work again
- mobile: the code pane is a 100px live strip instead of 47vh, so the CV
  starts at ~140px down the page (was ~450px)
- resume renders at ~1.2s (was 3.5s); the whole animation settles in ~2.8s
  (charsPerTick 5 -> 18) without gating the content
- "Skip animation" pill while typing, "Replay animation" afterwards, plus
  the existing prefers-reduced-motion short-circuit; repeat visitors get the
  finished page immediately via localStorage hoelee_cv_seen
- a11y: decorative code pane aria-hidden, resume pane tabindex=0 with
  aria-live off->polite, all typing loops honour a cancelled flag
- thank-you panel is content-sized (min-height 0) with a 68ch centred
  text block instead of a tall half-empty beige box
This commit is contained in:
hoelee committed 2026-11-14 00:35:11 +08:00
1 parent 5727ab0c8a
commit a20a79c855
6 files changed
+203 -24

No files matched your search

+59 -8
View File
@@ -1,7 +1,9 @@
<template>
<div id="app">
<button v-if="animating" class="skip-btn" type="button" @click="finishAll">Skip animation →</button>
<button v-else class="skip-btn replay-btn" type="button" @click="replay">↻ Replay animation</button>
<StyleEditor ref="styleEditor" :code="currentStyle"></StyleEditor>
<ResumeEditor ref="resumeEditor" :markdown="currentMarkdown" :enableHtml="enableHtml"></ResumeEditor>
<ResumeEditor ref="resumeEditor" :markdown="currentMarkdown" :enableHtml="enableHtml" :settled="!animating"></ResumeEditor>
<ThankEditor ref="thankEditor" :markdown="currentThankMarkdown" :enableHtml="enableHtml"></ThankEditor>
</div>
</template>
@@ -27,27 +29,54 @@
currentMarkdown: '',
currentThankMarkdown: '',
enableHtml: false,
animating: true,
cancelled: false,
styleFull: profile.mobileStyles.join('')
}
},
created() {
// Respect the OS "reduce motion" setting: render the finished page immediately.
// Finished page immediately for reduced motion or a repeat visit.
const reduce = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches
if (reduce) {
this.currentStyle = this.styleFull
this.currentMarkdown = this.fullMarkdown
this.enableHtml = true
this.currentThankMarkdown = this.thanksMarkdown
let seen = false
try { seen = window.localStorage.getItem('hoelee_cv_seen') === '1' } catch (e) { seen = false }
if (reduce || seen) {
this.finishAll()
return
}
this.makeResume()
this.makeResume().then(() => {
try { window.localStorage.setItem('hoelee_cv_seen', '1') } catch (e) { /* private mode */ }
})
},
methods: {
finishAll() {
this.cancelled = true
this.currentStyle = this.styleFull
this.currentMarkdown = this.fullMarkdown
this.currentThankMarkdown = this.thanksMarkdown
this.enableHtml = true
this.animating = false
},
// Replay is the only way back to the animation once it has been seen.
replay() {
this.cancelled = false
this.currentStyle = ''
this.currentMarkdown = ''
this.currentThankMarkdown = ''
this.enableHtml = false
this.htmlShown = false
this.thanksShown = false
this.animating = true
try { window.localStorage.removeItem('hoelee_cv_seen') } catch (e) { /* ignore */ }
this.makeResume().then(() => {
try { window.localStorage.setItem('hoelee_cv_seen', '1') } catch (e) { /* ignore */ }
})
},
makeResume: async function () {
await this.typeStyleUpToMarker('/* Start writing resume */')
await this.showHtml()
await this.typeStyleRemaining()
await this.progressivelyShowThanks()
this.animating = false
},
typeStyleUpToMarker(marker) {
return new Promise((resolve) => {
@@ -75,6 +104,7 @@
const total = this.styleFull.length
const step = this.increment(total)
const tick = () => {
if (this.cancelled) return resolve()
if (this.currentStyle.length < total) {
step()
setTimeout(tick, this.interval)
@@ -87,6 +117,7 @@
progressivelyShowStylePartial(target, resolve) {
const step = this.increment(target)
const tick = () => {
if (this.cancelled) return resolve()
if (this.currentStyle.length < target) {
step()
setTimeout(tick, this.interval)
@@ -115,6 +146,7 @@
const interval = this.interval
const cpt = this.charsPerTick
const showThanks = () => {
if (this.cancelled) return resolve()
if (this.currentThankMarkdown.length < length) {
this.currentThankMarkdown = this.thanksMarkdown.substring(0, Math.min(length, this.currentThankMarkdown.length + cpt))
// No auto-scroll while typing: yanking the page to the bottom on every tick
@@ -146,4 +178,23 @@
*{
box-sizing: border-box;
}
.skip-btn {
position: fixed;
top: .6em;
right: .75em;
z-index: 20;
padding: .4em .8em;
font: inherit;
font-size: .8rem;
color: #d7efe8;
background: rgba(0, 32, 32, .85);
border: 1px solid rgba(215, 239, 232, .45);
border-radius: 999px;
cursor: pointer;
}
.replay-btn {
opacity: .6;
}
</style>