Skip to content

Fix/issue 11367 long question UI#17160

Open
SOUMITRO-SAHA wants to merge 5 commits intoanomalyco:devfrom
SOUMITRO-SAHA:fix/issue-11367-long-question-ui
Open

Fix/issue 11367 long question UI#17160
SOUMITRO-SAHA wants to merge 5 commits intoanomalyco:devfrom
SOUMITRO-SAHA:fix/issue-11367-long-question-ui

Conversation

@SOUMITRO-SAHA
Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #11367

Type of change

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

What does this PR do?

This PR fixes a UI issue where long question text in the session question dock would push answer options off-screen, making them inaccessible to users.

Changes made:

  1. Dynamic height calculation in session-question-dock.tsx:
    • Enhanced the measure() function to dynamically calculate question text max-height
    • Accounts for header, progress bar, hint, and ensures 200px minimum space for options
    • Uses CSS custom properties (--question-text-max-height) for responsive behavior
  2. Scrollable question text area:
    • Added max-height constraint with overflow-y: auto to question text slot
    • Custom scrollbar styling with hover states for better UX
    • Works seamlessly even when custom answer textarea is expanded
  3. Performance optimizations:
    • Caches scroller and dock elements to avoid repeated DOM queries
    • Debounced resize handler (100ms) to reduce recalculation frequency
    • Proper cleanup of cached references on unmount
  4. Comprehensive E2E tests covering:
    • Long question text with scrolling behavior
    • Multiple tabs with long questions
    • Moderate text (verifies no unnecessary scrolling)
    • Questions with 50+ items
    • Custom answer interaction with long questions

How did you verify your code works?

  • Added 5 comprehensive E2E test scenarios in question-scroll.spec.ts that verify scrolling behavior across different question lengths and scenarios
  • All tests verify that:
    • Answer options remain visible and clickable
    • Scrolling activates only when content exceeds available space
    • Custom answer functionality works correctly with long questions
    • Navigation between multiple long questions works smoothly

Screenshots / recordings

Before Fix:
image

After Fix:
image

2026-03-12.13-27-07.mp4

Detailed Video Demonstration with Responsive Testing – Google Drive

Checklist

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

Implement scrolling constraints for question text to ensure answer
options remain visible.
Add dynamic height calculation and scrollbar styling to improve UI
experience with long questions.
- Add comprehensive e2e tests for question scrolling behavior
- Implement question text max-height calculation in
  session-question-dock component
- Add CSS scrollbar styling for question text with hover states
- Update Storybook with enhanced documentation and test cases
Remove screenshot capture operations from question scrolling e2e tests
to improve
test reliability and execution time. Replace visual verification with
assertions.

- Remove screenshot directory creation and file operations
- Replace screenshot capture with proper scrolling behavior assertions
- Remove console.log statements for cleaner test output
- Add scroll height comparison assertions to validate scrolling behavior
To improve test stability and prevent flakiness during UI interactions.
measurement

Replace hardcoded height values with actual DOM element measurements to
ensure
accurate height calculation across different themes and layouts.

- Add element caching to improve performance
- Replace magic numbers with `getBoundingClientRect()` measurements
- Implement debounced resize handler to prevent layout thrashing
- Add error handling for measure function
- Measure header, progress, and hint elements dynamically
@github-actions
Copy link
Copy Markdown
Contributor

Hey! Your PR title Fix/issue 11367 long question UI doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions
Copy link
Copy Markdown
Contributor

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

Results

Potential Related PR Found:

Note: The current PR #17160 is the only match for most of the specific searches, indicating this appears to be addressing a unique issue. PR #15253 is the only potentially related PR found that touches the same component area.

@SOUMITRO-SAHA
Copy link
Copy Markdown
Contributor Author

If you would like me to implement the fix on the CLI (TUI) as well, please feel free to assign the task to me.

At the moment, I am facing some issues with the scrolling behaviour in the TUI using @opentui/solid. I tried several approaches to handle scrolling, but none of them worked as expected, so I did not include those changes in this PR.

If fixing this is important, could you please share any documentation or references related to scrolling behaviour in the TUI? That would really help me proceed with the implementation.

@adamdotdevin @rekram1-node

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Long question tool makes opencode unusable

1 participant