Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/GLOSSARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -7431,6 +7431,8 @@ A paper signed before v2.9096's deploy keeps its emptied link and still reads as
Since v2.9110 that thank-you offers no way into the app to an outside signer or a customer, as the page says right after a signature (`signedLinkAudience`).
Since v2.9113 (finding 722) the thank-you says that no copy was emailed and to ask the person who gave the paper for one when `accept-contract` answers `not_sent`, and nothing for `pending` (`signedCopyWords` in [`signerAfterSigning.ts`](../src/lib/contracts/signerAfterSigning.ts)).
Since v2.9143 (finding 685) the signing page asks the public layout for its compact band in each of its five states, so on a phone the paper's name stands on the first screen, as the page a signing code opens has since it was built ([`ContractAccept.tsx`](../src/pages/ContractAccept.tsx)).
Since v2.9279 the signing page's paper box carries **Full screen**: the press opens the same box over the whole window, **Back to signing** at its head and its foot or Escape puts it back, and the reader's place is kept both ways as a share of the way down ([`PaperReadBox.tsx`](../src/components/contracts/PaperReadBox.tsx), words and place in [`paperFullWindow.ts`](../src/lib/contracts/paperFullWindow.ts)).
The signing page holds nobody to reading to the end before they sign, so the full window changes no rule of the signing.
Since v2.9129 (punch list #458, call 15) a signed agreement's record carries **Email the signed copy…** for the four roles that send a paper ([`SignedCopyEmailPress.tsx`](../src/components/contracts/SignedCopyEmailPress.tsx), words and rules in [`signedCopyEmail.ts`](../src/lib/contracts/signedCopyEmail.ts)).
It opens **Email it to** on the address the paper kept (`signer_email`), shows **Mobile they gave** when a walk-up off a signing code gave one (`signer_phone`), and says when a copy last went (`signed_copy_sent_at`).
**Email the copy** asks `person-paper-pdf` with `email_to`, which sends the signature's own email and PDF to that address and changes nothing else on the paper.
Expand Down
29 changes: 29 additions & 0 deletions docs/recent-features/v2.9279.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# v2.9279 — Signing page: read the paper full screen (2026-12-03)

The owner's words, with a picture of the public signing page: *can we add a full screen button to be able to see the contract full screen?* Client only. No migration, no function change, nothing owed on prod.

## What changed

- **The paper's box carries Full screen** ([`PaperReadBox.tsx`](../../src/components/contracts/PaperReadBox.tsx)). The press stands over the box at its right, with the app's full-screen glyph. It opens the same box over the whole window: one box that changes its shape, never a second copy of the paper, so what is read in the window is the paper that is signed.
- **Back to signing** stands at the window's head, which stays in view while the paper scrolls, and again as a wide press at the paper's end. Escape closes the window too. The cursor goes to **Back to signing** on the way in and back to **Full screen** on the way out, and Tab stays inside the window while it is open.
- **The reader's place is kept both ways** ([`paperFullWindow.ts`](../../src/lib/contracts/paperFullWindow.ts), `readPlace` and `scrollTopForPlace`). A wider window wraps the words onto fewer lines, so the place is kept as a share of the way down, not as a count of pixels.
- **The page stays light.** The public layout pins the page light, and the window is the page's own box, so it is light in a dark browser too.
- **On a phone** the presses are 44 px tall, the window's top keeps clear of the status bar (`--app-top-chrome`, held by `check:status-bar`) and its foot of the home bar, the head never scrolls away, the page behind does not scroll, and the app's *A new version is ready* pill waits as it does for any window that fills the screen.
- **Spanish**: a paper read in Spanish reads **Pantalla completa** and **Volver a firmar**.

## Where it holds

Every paper `/contract/accept` draws as words: a plain paper's box, and the box under **The full agreement** on a paper built from clauses. A fillable form is not a scrolling box of words and has no such press.

## What the page asks before a signature

The page was read first for a hold on reading to the end. There is none: the form asks for a name, the consent and the tick *I have read and agree to this contract*, and nothing reads how far the box was scrolled. So the full window changes no rule of the signing, and a test signs after reading in the window.

## Not covered

- `/contract/sign`, the job's own contract, folds its terms under **Read the full terms** and is a different page. It has no such press yet.
- Not looked at on the live site: the page needs a real signing link, so the look goes through the walker.

## Tests

`paperFullWindow.test.ts` (the words, the place, Tab's wrap), `PaperReadBox.render.test.tsx` (the window, its two closes, Escape, Tab, the place, Spanish) and `ContractAccept.fullWindow.render.test.tsx` (the page offers it on a plain paper and on a paper built from clauses, and a signer signs after it).
108 changes: 108 additions & 0 deletions src/components/contracts/PaperReadBox.render.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
// @vitest-environment jsdom
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { fireEvent, render, screen } from '@testing-library/react'
import { PaperReadBox } from './PaperReadBox'

const BOX = { maxHeight: 420, overflow: 'auto' } as const

function mount(lang?: 'en' | 'es') {
return render(
<div>
<PaperReadBox paperName="ZZ Test Agreement" lang={lang} boxStyle={BOX} testId="paper">
<p data-testid="words">The paper's own words.</p>
</PaperReadBox>
<button type="button">Accept document</button>
</div>,
)
}

// The scroll lock puts the page back where it was when the window closes, and jsdom has no scrollTo.
beforeEach(() => {
window.scrollTo = vi.fn() as unknown as typeof window.scrollTo
})

describe('PaperReadBox: the paper over the whole window (v2.9279)', () => {
it('draws the paper in its box with Full screen over it, and no window yet', () => {
mount()
expect(screen.getByRole('button', { name: 'Full screen' })).toBeTruthy()
expect(screen.queryByRole('dialog')).toBeNull()
expect(screen.queryByRole('button', { name: 'Back to signing' })).toBeNull()
expect(screen.getByTestId('paper-paper').style.maxHeight).toBe('420px')
})

it('Full screen opens the same paper over the whole window, named for the paper', () => {
mount()
const words = screen.getByTestId('words')
fireEvent.click(screen.getByRole('button', { name: 'Full screen' }))
const win = screen.getByRole('dialog', { name: 'ZZ Test Agreement, full screen' })
expect(win.style.position).toBe('fixed')
expect(win.getAttribute('aria-modal')).toBe('true')
// The same words, never a second copy: what is read in the window is the paper that is signed.
expect(screen.getAllByTestId('words')).toHaveLength(1)
expect(screen.getByTestId('words')).toBe(words)
expect(win.contains(words)).toBe(true)
// The window's top keeps clear of a phone's status bar, and its head stands over the box that scrolls.
expect(win.style.paddingTop).toBe('var(--app-top-chrome, 0px)')
expect(screen.getByTestId('paper-paper').style.overflow).toBe('auto')
// A press at the head and one at the foot, and the cursor on the head's.
expect(screen.getAllByRole('button', { name: 'Back to signing' })).toHaveLength(2)
expect(document.activeElement).toBe(screen.getByTestId('paper-back'))
})

it('Back to signing closes it, from the head and from the foot, and the cursor returns to Full screen', () => {
mount()
for (const press of ['paper-back', 'paper-back-foot']) {
fireEvent.click(screen.getByRole('button', { name: 'Full screen' }))
fireEvent.click(screen.getByTestId(press))
expect(screen.queryByRole('dialog')).toBeNull()
expect(screen.getByTestId('paper-paper').style.position).toBe('')
expect(document.activeElement).toBe(screen.getByRole('button', { name: 'Full screen' }))
}
})

it('Escape closes it', () => {
mount()
fireEvent.click(screen.getByRole('button', { name: 'Full screen' }))
fireEvent.keyDown(window, { key: 'Escape' })
expect(screen.queryByRole('dialog')).toBeNull()
expect(screen.getByTestId('words')).toBeTruthy()
})

it('Tab stays inside the window while it is open', () => {
mount()
fireEvent.click(screen.getByRole('button', { name: 'Full screen' }))
const head = screen.getByTestId('paper-back')
const foot = screen.getByTestId('paper-back-foot')
foot.focus()
fireEvent.keyDown(window, { key: 'Tab' })
expect(document.activeElement).toBe(head)
fireEvent.keyDown(window, { key: 'Tab', shiftKey: true })
expect(document.activeElement).toBe(foot)
})

it("keeps the reader's place going in and coming back", () => {
mount()
const box = screen.getByTestId('paper-paper')
// The box is 420 tall over 1,420 of words. The window is 900 tall, and wider, so the same words run 1,700.
const isFull = () => document.querySelector('[data-paper-full]') !== null
let top = 250
Object.defineProperty(box, 'scrollTop', { configurable: true, get: () => top, set: (v: number) => { top = v } })
Object.defineProperty(box, 'scrollHeight', { configurable: true, get: () => (isFull() ? 1700 : 1420) })
Object.defineProperty(box, 'clientHeight', { configurable: true, get: () => (isFull() ? 900 : 420) })
// A quarter of the way down the box is a quarter of the way down the window.
fireEvent.click(screen.getByRole('button', { name: 'Full screen' }))
expect(screen.getByTestId('paper-paper')).toBe(box)
expect(top).toBe(200)
// Read on to half way in the window, and come back half way down the box.
top = 400
fireEvent.click(screen.getByTestId('paper-back'))
expect(top).toBe(500)
})

it('reads in Spanish for a paper read in Spanish', () => {
mount('es')
fireEvent.click(screen.getByRole('button', { name: 'Pantalla completa' }))
expect(screen.getByRole('dialog', { name: 'ZZ Test Agreement, pantalla completa' })).toBeTruthy()
expect(screen.getAllByRole('button', { name: 'Volver a firmar' })).toHaveLength(2)
})
})
178 changes: 178 additions & 0 deletions src/components/contracts/PaperReadBox.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
/**
* The box a signer reads a paper in, with **Full screen** over it (v2.9279). The box is the page's own: half a screen
* tall, scrolling. The press opens the same box over the whole window, and **Back to signing**, at its head and at
* its foot, or Escape, puts it back. The words, the place kept both ways and Tab's wrap are `paperFullWindow.ts`.
*
* It is one box that changes its shape, never a second copy of the paper, so what the signer reads in the window is
* the paper they sign. The page is pinned light, and the window stands inside the page, so it is light too.
*
* The window is a column: its head, which never scrolls, over the box, which does. So the head stays under a phone's
* status bar while the words run, and the window's own top keeps clear of it (`--app-top-chrome`).
*/
import { useCallback, useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ReactNode } from 'react'
import { useBodyScrollLock } from '../../hooks/useBodyScrollLock'
import { markPhoneWindowOpen } from '../../lib/phoneSheetOpen'
import { PAPER_FULL_WINDOW_WORDS, readPlace, scrollTopForPlace, tabWrap, type PaperWindowLang } from '../../lib/contracts/paperFullWindow'
import { ModalFullScreenIcon } from '../icons/ModalFullScreenIcon'

/** A fingertip, as the signing form's own presses stand. */
const PRESS_MIN_HEIGHT = 44

const openPress: CSSProperties = {
display: 'inline-flex',
alignItems: 'center',
gap: '0.4rem',
minHeight: PRESS_MIN_HEIGHT,
padding: '0.3rem 0.8rem',
border: '1px solid var(--border-strong)',
borderRadius: 6,
background: 'var(--surface)',
color: 'var(--text-700)',
fontFamily: 'inherit',
fontSize: '0.875rem',
fontWeight: 600,
cursor: 'pointer',
}
const fullWindow: CSSProperties = {
position: 'fixed',
inset: 0,
zIndex: 9000,
display: 'flex',
flexDirection: 'column',
background: 'var(--surface)',
color: 'var(--text-base)',
outline: 'none',
paddingTop: 'var(--app-top-chrome, 0px)',
}
const head: CSSProperties = {
flex: '0 0 auto',
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
gap: '0.75rem',
padding: '0.5rem 1rem',
borderBottom: '1px solid var(--border)',
background: 'var(--surface)',
}
/** The box while the window is open: the rest of the window, scrolling. */
const fullBox: CSSProperties = { flex: '1 1 auto', minHeight: 0, overflow: 'auto', overscrollBehavior: 'contain', fontSize: '0.95rem' }
const headName: CSSProperties = { minWidth: 0, fontSize: '1rem', fontWeight: 700, color: 'var(--text-strong)', overflowWrap: 'anywhere' }
const words: CSSProperties = { maxWidth: '46rem', margin: '0 auto', padding: '1rem 1rem 1.25rem' }
const foot: CSSProperties = { maxWidth: '46rem', margin: '0 auto', padding: '0 1rem calc(1.5rem + env(safe-area-inset-bottom, 0px))' }
const footPress: CSSProperties = {
width: '100%',
minHeight: PRESS_MIN_HEIGHT,
padding: '0.5rem 1rem',
border: '1px solid #2563eb',
borderRadius: 6,
background: '#2563eb',
color: 'white',
fontFamily: 'inherit',
fontSize: '1rem',
fontWeight: 600,
cursor: 'pointer',
}

export function PaperReadBox({
paperName,
lang = 'en',
boxStyle,
testId = 'paper-read-box',
children,
}: {
/** The paper's name: the full window's heading, and its name for a screen reader. */
paperName: string
lang?: PaperWindowLang
/** The box as the page draws it while it is not full. */
boxStyle: CSSProperties
testId?: string
children: ReactNode
}) {
const [full, setFull] = useState(false)
const win = useRef<HTMLDivElement>(null)
const box = useRef<HTMLDivElement>(null)
const open = useRef<HTMLButtonElement>(null)
const back = useRef<HTMLButtonElement>(null)
/** The reader's place, read just before the box changes its shape. */
const place = useRef(0)
const turned = useRef(false)
const w = PAPER_FULL_WINDOW_WORDS[lang]

const turn = useCallback((next: boolean) => {
if (box.current) place.current = readPlace(box.current)
turned.current = true
setFull(next)
}, [])

// The page behind stays still, and on a phone the app's pill waits as it does for any window that fills the screen.
useBodyScrollLock(full)
useEffect(() => (full ? markPhoneWindowOpen() : undefined), [full])

// After the box has changed its shape: the same place, and the cursor on the press that undoes what was pressed.
useLayoutEffect(() => {
if (!turned.current) return
turned.current = false
const el = box.current
if (el) el.scrollTop = scrollTopForPlace(place.current, el)
;(full ? back.current : open.current)?.focus()
}, [full])

useEffect(() => {
if (!full) return
const onKey = (e: KeyboardEvent) => {
if (e.key === 'Escape' && !e.defaultPrevented) {
e.preventDefault()
turn(false)
return
}
if (e.key !== 'Tab' || !win.current) return
const stops = Array.from(win.current.querySelectorAll<HTMLElement>('button, a[href], [tabindex]:not([tabindex="-1"])'))
const to = tabWrap(stops.length, stops.indexOf(document.activeElement as HTMLElement), e.shiftKey)
if (to == null) return
e.preventDefault()
stops[to]?.focus()
}
window.addEventListener('keydown', onKey)
return () => window.removeEventListener('keydown', onKey)
}, [full, turn])

return (
<div data-testid={testId}>
<div style={{ display: 'flex', justifyContent: 'flex-end', marginBottom: '0.35rem' }}>
<button ref={open} type="button" style={openPress} onClick={() => turn(true)} data-testid={`${testId}-open`}>
<ModalFullScreenIcon fullScreen={false} size={14} />
{w.open}
</button>
</div>
<div
ref={win}
{...(full ? { role: 'dialog', 'aria-modal': true, 'aria-label': w.windowName(paperName), tabIndex: -1 } : {})}
data-paper-full={full ? '' : undefined}
data-testid={`${testId}-window`}
style={full ? fullWindow : undefined}
>
{full ? (
<div style={head}>
<span style={headName}>{paperName}</span>
<button ref={back} type="button" style={{ ...openPress, flex: '0 0 auto' }} onClick={() => turn(false)} data-testid={`${testId}-back`}>
<ModalFullScreenIcon fullScreen size={14} />
{w.back}
</button>
</div>
) : null}
<div ref={box} lang={lang} data-testid={`${testId}-paper`} style={full ? fullBox : boxStyle}>
<div style={full ? words : undefined}>{children}</div>
{full ? (
<div style={foot}>
<button type="button" style={footPress} onClick={() => turn(false)} data-testid={`${testId}-back-foot`}>
{w.back}
</button>
</div>
) : null}
</div>
</div>
</div>
)
}

export default PaperReadBox
2 changes: 2 additions & 0 deletions src/content/help/send-one-contract-to-one-person.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ The CLICK. letterhead on the same paper as the sub portal · **One document to s
- **Opening message** is the only part in your words. Leave it blank for the default line. Or write it like a text to the person: "Taunya, here's the agreement we talked about. Sign once and it covers every job."
- The link works for **14 days**. Sending again mints a fresh link and a fresh email.

The link opens the signer's page. The paper stands in a box above the signing form. **Full screen** opens the paper over the whole window. **Back to signing** brings the signer back to the form.

## When the email does not go

Sometimes the mail service refuses an address. The paper is still made, and its signing link works. The window does not close. An amber block above **Send email** says so.
Expand Down
16 changes: 16 additions & 0 deletions src/content/releaseNotes/v2.9279.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { ReleaseNote } from '../../lib/releaseNotes'

const note: ReleaseNote = {
version: 'v2.9279',
date: '2026-12-03',
title: 'Signing page: read the paper full screen',
kind: 'feature',
highlights: [
'The page a signer opens now has Full screen over the paper. One press opens the paper over the whole window, so a long agreement is no longer read through a small box.',
'Back to signing, at the top and at the end of the paper, brings the signer back to the form. Escape does the same.',
'The signer keeps their place going in and coming back. On a phone the presses are a fingertip tall.',
'Signing itself is unchanged. The page asks for a name and the ticks, as before.',
],
}

export default note
Loading
Loading