Skip to content

fix(image-viewer): open fitted to the screen, with Fit and 1:1 zoom - #226

Merged
kahme247 merged 83 commits into
kahme247:mainfrom
andrebrait:fix/lightbox-fit-zoom
Oct 8, 2026
Merged

kahme247 merged 83 commits into
kahme247:mainfrom
andrebrait:fix/lightbox-fit-zoom

Conversation

@andrebrait

@andrebrait andrebrait commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The image viewer (lightbox) opened every image at 100%, even on phones, so a large screenshot showed as a small corner. The minimum zoom of 25% was still far too large for big images.

  • Opens fitted to the screen on every device. The fit is measured from the viewport's content box, so the padding stays visible. Images smaller than the screen stay at their real size instead of being enlarged.
  • The zoom percentage is relative to real pixels. A 6000×4000 image opens at 20% on a 1400×900 desktop and at 6% on a 390×844 phone.
  • Zoom out goes down to 10%, or to the fitted size for very large images, in ×1.25 steps instead of ±25%.
  • Fit to screen and 1:1 buttons replace Reset zoom, with aria-pressed showing which one is active.
  • Zooming keeps the centre of the view in place. Going to 1:1 shows the middle of the image, not its top-left corner.
  • A zoomed-in image scrolls to every edge. The image is sized by layout instead of transform: scale, which did not grow the scroll area, so the parts beyond the starting size could not be reached.
  • An image that fails to load, or has no intrinsic size, is shown as the browser renders it instead of staying hidden.
  • The viewer's buttons get 44px targets under the Touch Targets setting, and the toolbar wraps on narrow screens instead of clipping them.
  • Works at every Interface Scale. The viewer covers exactly the window, and fit, 1:1 and every percentage are in real screen pixels: the root zoom no longer stretches the image.

Verification

  • tsc --noEmit, lint, npm test: 1,219 pass / 0 fail. New tests cover fitZoom (width- and height-limited, no upscaling, zero sizes) and stepZoom (×1.25 steps, the min(fit, 10%) floor, the 800% cap).
  • Headless Chromium on an isolated dev server with a 6000×4000 image:
    • Desktop 1400×900: opens at 20%. 1:1 shows 6000×4000, the scroll area is 6048×4048 (every edge reachable), and the view is centred at 50%/50%. Zoom out stops at 10%; Fit returns to 20%.
    • Phone 390×844: opens at 6%, and zoom out is disabled at the fit.
    • A broken image stays visible, with the zoom controls disabled.
    • With data-touch-targets="accessible", all viewer buttons measure 44×44.
  • Compact and Large Interface Scale at 1400×900: the viewer covers exactly 1400×900, fit is about 20% at both, and 1:1 measures 6000 screen px. On a 360×760 phone at Large scale with Accessible targets, all five buttons are reachable at 44px.
  • One condensed adversarial review round, then Codex and CodeRabbit on the review companion ([companion] fix(image-viewer): open fitted to the screen, with Fit and 1:1 zoom andrebrait/ompweb#85). Every finding is fixed in follow-up commits. CodeRabbit had no comments, and Codex's last review of the final head found nothing.

andrebrait and others added 30 commits October 3, 2026 12:54
The pruning that bounds the job store deletes a `gone` tombstone with no
client-visible signal, so a browser that adopted another browser's recording
could get a 404 and raise an error toast for a job that had in fact been
delivered elsewhere. Only the browser that recorded (or retried) a job holds
the audio to fall back on, so only it may report it as a failure; a follower
that is locked out of the transcript is standing down by design.

The attached-messages toast also blamed the agent for a rule that has nothing
to do with it: `sendQueued` refuses attachments whether or not a run is
active, and `followUp` is dispatched immediately when the agent is idle. The
rule and its explanation are now one predicate, `queueAllowsAttachments`, used
by both `sendQueued` and the dictation branch, so they cannot drift apart.
Stop withdrew queued messages one by one from this client's queue snapshot
before aborting. A steer missing from that snapshot (promoted after the last
queue_update) or claimed by the run but not yet recorded was never withdrawn,
and omp drained it into a new turn right after the abort: the user pressed
Stop and the steer ran anyway.

Stop now sends abort_and_restore_queue, omp's Esc in one step (clearQueue
forInterrupt, then abort), and restores the returned texts to the draft. omp
without the command falls back to the per-entry withdrawal.
Review of the atomic Stop:
- Capture the run fence at the click; a failed request is retried once and
  only while that run is current, so it can never abort a newer run.
- Fall back to per-entry withdrawal only on "Unknown command" (omp without
  abort_and_restore_queue); any other failure retries the same command, and
  warns (new localized queueRestoreUncertain) when nothing came back.
- Narrow the try to the request; drop an image-only "[Image]" label.
- Tests: retry restores, lost response warns, no retry into a newer run,
  overlapping Stops share one request; tidy the server abort branch.
Prepare ompweb for publisher-default Auto effort in can1357/oh-my-pi#14114. Persist the choice through native config, preserve provider settings, and show the control and search result only when Reasoning is auto.
…in browser code

Older browsers lack these APIs: Settings crashed on open, session catch-up stalled, and transcription polling failed. Use AbortController timers and plain promises, keeping the same timeouts and cancellation. Fixes kahme247#196.
Reuse the workspace refresh control and success checkmark. Bypass the server usage cache only for manual refreshes while retaining the existing five-minute automatic polling schedule.
Keep background polling silent, preserve refresh queries on older browsers, and ensure manual refresh is not satisfied by a concurrent background fetch. Cover persisted caching and hook behavior with regression checks.
A manual refresh must attempt cache invalidation even when the automatic fetch it waited behind rejects. Extend the CLI-backed regression to cover this failure path.
The reasoning trigger shows the terminal status line's level glyph instead
of the level name (chevron hidden in narrow toolbars), so the model name
keeps the room on phones. The menu pairs each glyph with its name.

Slow was wired only for saved sessions, so a new session never showed it
even after Fast had spawned omp. Offer it in new sessions too, and refresh
live state after a new-session model change so support follows the model.
Without live omp state (new or idle session), predict omp's slowModeTarget
from the catalog: /api/models marks supportsSlowMode by provider and
reports providers.anthropic.slowMode, read fresh outside the models cache.
Claude shows the shared setting (global scope); flex starts off (session).
Live get_state wins as soon as omp runs, and clicking the toggle spawns
omp like Fast does.
…t code

Older mobile browsers lack these APIs, so calling them crashed the whole
tree into the unexpected-error screen. Use browser-safe helpers.

Fixes kahme247#196

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011RZdyVoycH4WVVDWJNctDR
… again

Handle the session-persistence notice: re-read identity, keep the run
state, re-key the registry (old id stays as an alias) and reuse a live
wrapper that already reports the requested session file.

Fixes kahme247#202

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011RZdyVoycH4WVVDWJNctDR
- auto-name asks omp (generate_title, else /rename) and only falls back to
  the derived title when omp cannot (Fixes kahme247#203)
- provider detail lists the accounts omp reports for the provider (Refs kahme247#197)
- tests and AGENTS.md notes

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011RZdyVoycH4WVVDWJNctDR
fix(queue): take the queue back on Stop through omp's atomic Esc
feat: add a Slow toggle and provider-neutral usage-limit badge
…urce

feat(settings): add Auto thinking source selector
…efresh

feat(usage): add manual provider usage refresh
…-compatibility

fix(client): avoid AbortSignal.timeout/any and Promise.withResolvers
Take main's kahme247#199 client fix instead of the duplicate abort-signal helper.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011RZdyVoycH4WVVDWJNctDR
…edes-297gxo

Support omp session moves and native title generation
Show the branch below the workspace name, keep the activity indicator beside the name, and preserve space for rename and branch controls.
Use OMP live resolution instead of duplicating discovery.
Keep the native notice preference and never resume stopped sessions for
inspection.
Add an icon-only dismiss button that hides the current report until its diagnostics change, and shorten the disable action to "Turn this off" so the notice text keeps its width on phones.
claude and others added 11 commits October 5, 2026 14:19
# Conflicts:
#	CHANGELOG.md
# Conflicts:
#	CHANGELOG.md
# Conflicts:
#	CHANGELOG.md
# Conflicts:
#	components/AppShell.tsx
#	components/ChatInput.tsx
#	components/SessionSidebar.tsx
# Conflicts:
#	README.md
#	hooks/useAgentSession.ts
The lightbox opened at 100% on every device and zoomed with a transform
that did not grow the scroll area. Open fitted to the viewport (never
upscaling small images), show zoom relative to real pixels, step by x1.25
down to min(10%, fit), size the image by layout so every edge scrolls into
view, and replace Reset zoom with Fit to screen and 1:1.
Keep the centre of the view across zoom changes, show an image that fails
to load (or has no intrinsic size) instead of leaving it hidden, size only
once both the image and the viewport are measured, and give the viewer
buttons 44px targets under the Touch Targets setting.
Viewport units ignore the root zoom, so the viewer was sized past the
window (Comfortable/Large) or short of it (Compact) and fit to that.
…lbar

Measure fit and size the image in screen pixels so 1:1 and every
percentage ignore the root zoom, and let the toolbar wrap so large touch
targets stay reachable on narrow screens.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 7, 2026
…it and 1:1 zoom

Squashed from origin/fix/lightbox-fit-zoom (2a5f0e1) onto upstream/main.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 7, 2026
…it and 1:1 zoom

Squashed from origin/fix/lightbox-fit-zoom (2a5f0e1) onto upstream/main.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 7, 2026
…it and 1:1 zoom

Squashed from origin/fix/lightbox-fit-zoom (2a5f0e1) onto upstream/main.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 7, 2026
…it and 1:1 zoom

Squashed from origin/fix/lightbox-fit-zoom (2a5f0e1) onto upstream/main.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 7, 2026
…it and 1:1 zoom

Squashed from origin/fix/lightbox-fit-zoom (2a5f0e1) onto upstream/main.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 7, 2026
…it and 1:1 zoom

Squashed from origin/fix/lightbox-fit-zoom (2a5f0e1) onto upstream/main.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 7, 2026
…it and 1:1 zoom

Squashed from origin/fix/lightbox-fit-zoom (2a5f0e1) onto upstream/main.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 7, 2026
…it and 1:1 zoom

Squashed from origin/fix/lightbox-fit-zoom (2a5f0e1) onto upstream/main.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 7, 2026
…it and 1:1 zoom

Squashed from origin/fix/lightbox-fit-zoom (2a5f0e1) onto upstream/main.

@kahme247 kahme247 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review — approve (SHIP, all three)

Verified by independent review with attack probes and joint-tree merges.

Tool-result images (#223). [hash] validated by ^[a-f0-9]{64}$ (traversal/uppercase/suffix all 404 by test); MIME from magic bytes only (SVG/HTML rejected); nosniff; 16MB memo cap + 30-day sweep. Only new dep is sharp, lock in sync. Non-blocking follow-ups noted: disk-quota cap, sharp as optionalDependency for exotic platforms.

Lightbox (#226). Zoom math sound (fit returns 1 on zero-size; steps clamp to [min(fit,10%), 800%]); native <dialog> focus handling; locales consistent; inline reset SVG replaced with lucide Maximize.

Markdown links (#224). href="" trap closed (rejected schemes arrive as undefined → <span>); anchors stay, externals get target=_blank rel=noopener noreferrer, unopenable locals become plain text; no server-side fetch of attacker URLs (no SSRF). Joint trees compose cleanly.

@kahme247
kahme247 force-pushed the main branch 2 times, most recently from 3f1dbea to 42b3c29 Compare October 8, 2026 13:30
@kahme247
kahme247 merged commit dcfa2fd into kahme247:main Oct 8, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants