fix(app): text-card question renders visible, focused, sized textarea - #124
Merged
Merged
Conversation
…#121) Three compounding failures made kind:"text" question cards show no input: 1. CSS visibility: the textarea reused the choice-card's transparent/borderless custom-input style. Add a scoped [data-slot="question-text-form"] rule that gives it a border, background, radius, and min-height — the textarea is now visually distinct as the primary affordance. 2. Container measurement race: resizeInput sets height=0 then scrollHeight, but the ResizeObserver could fire during the transient. After resizeInput, sync optionsHeight explicitly so the container always accommodates the textarea. 3. Focus routing: focus() targeted customRef (the choice-card's "Type your own answer" button) which doesn't render for text-kind questions. Short-circuit the focus function when text() is true — focusCustom handles it via the ref callback. Closes #121
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes three compounding failures that made
kind: "text"question cards (the free-form input from PR #113 / amicode#245) render no visible text input.Changes
1. CSS visibility (
message-part.css)Added a scoped
[data-slot="question-text-form"]rule that gives the textarea a border, background tint, border-radius, and min-height when it is the primary input affordance. The choice-card's secondary custom-input stays transparent/borderless.2. Container measurement race (
session-question-dock.tsx)After
resizeInput(which sets height=0→scrollHeight), explicitly syncoptionsHeightso the container never clips the textarea due to a ResizeObserver timing race.3. Focus routing (
session-question-dock.tsx)Short-circuit
focus()whentext()is true — the textarea is the only focusable element andfocusCustomhandles it via the ref callback. Previouslyfocus(0)targetedcustomRef(the choice-card's button), which doesn't render for text-kind questions.Acceptance Criteria
Verification
npm run lint— 0 new errors (1 pre-existing octal-literal error in an unrelated file)tsgo -b— clean across all 30 packages (pre-push hook)bun testinpackages/app— 748 pass, 0 new failuresCloses #121