Skip to content

fix(app): keep question dock buttons visible on mobile#24351

Open
ajaytravel wants to merge 3 commits intoanomalyco:devfrom
ajaytravel:fix/question-dock-mobile-overflow
Open

fix(app): keep question dock buttons visible on mobile#24351
ajaytravel wants to merge 3 commits intoanomalyco:devfrom
ajaytravel:fix/question-dock-mobile-overflow

Conversation

@ajaytravel
Copy link
Copy Markdown

@ajaytravel ajaytravel commented Apr 25, 2026

Issue for this PR

Closes #23730
Closes #22439

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

On mobile, the question dock's next/dismiss buttons get clipped below the viewport when the dock has long content.

While preparing this fix I traced the DOM and found that measure() was already silently broken: it ran scroller.firstElementChild.classList.contains("sticky"), but the scroller's first child is the setContentRef wrapper <div class="min-w-0 w-full"> — the sticky title is one level deeper. The check never matched, so measure() always hit the removeProperty path and the CSS fallback 100dvh was the only thing setting the height. On desktop the available area is usually large enough to hide that, but on mobile long content overflows and the footer gets clipped.

This PR makes measure() do what it was trying to do:

  1. Scope lookups to the session panel containing the dock instead of using document-level selectors.
  2. Use the semantic [data-session-title] selector (already used by use-session-hash-scroll.ts) instead of walking through firstElementChild.
  3. Fall back to the panel's message scroller top when no session title is rendered, so the dock is still bounded by the visible content area.
  4. Observe the scoped panel/header/scroller inputs that affect the measurement.

#24022 fixes the same bug with broader scope (CSS overflow-hidden on dock containers, visualViewport.height for keyboard handling, paddingBottom inset). This PR is the smaller measurement fix; happy to defer or compose.

How did you verify your code works?

  • bun run typecheck — all 13 packages pass
  • bun run --cwd packages/app test:unit — 307 pass, 0 fail
  • bun run lint on the changed file — 0 errors, no new warnings
  • Pre-push hook ran full repo typecheck successfully
  • Manually traced the DOM (session panel → ScrollView → .scroll-view__viewport → setContentRef wrapper → [data-session-title]) to confirm the original selector mismatch
  • Reasoned through desktop / mobile / no-header / no-scroller cases

Screenshots / recordings

I don't have a phone harness set up to capture before/after; #24022 has video recordings of the same bug.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

When no sticky session header is rendered (e.g. on mobile with no title),
measure() removed the --question-prompt-max-height var, leaving the
100dvh CSS fallback. The dock would then exceed the visible content area
and clip the next/dismiss buttons below the viewport.

Use the scroller's top edge as the fallback so the dock stays bounded by
the available content area in that case.

Refs anomalyco#23730, anomalyco#22439
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Apr 25, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Found a potentially related PR:

PR #24022: fix(app): prevent question dock overflow
#24022

This PR appears to be addressing a very similar issue - it's also about preventing question dock overflow, which is directly related to the mobile viewport clipping problem described in PR #24351. Both PRs are fixing issues with the question dock component overflowing and buttons being hidden/clipped. You should review whether these PRs are duplicates or if they address different aspects of the same problem.

@github-actions github-actions Bot removed needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels Apr 25, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@ajaytravel

This comment has been minimized.

@ajaytravel ajaytravel closed this Apr 25, 2026
@ajaytravel

This comment has been minimized.

@ajaytravel ajaytravel reopened this Apr 25, 2026
…sure

The previous heuristic walked into the scroller's first child and checked
for a 'sticky' class, but that first child is the setContentRef wrapper
(not the title), so the check never matched and measure() always fell
back to removing the var \u2014 leaving 100dvh in place.

Switch to the same [data-session-title] selector use-session-hash-scroll
already uses. Drops the apologetic comment and an intermediate variable
since names now reveal intent.
Avoid relying on document-level selectors when measuring the question dock.
The message scroller and session title live in the same session panel as the
dock, so scoping there keeps the calculation tied to the panel it affects.
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.

Unable to scroll the question in mobile view Serve: Mobile: Large approval request actions not visible

2 participants