Skip to content

🐛 Launcher Voice Affordance and Textarea Auto-Height#86

Merged
cristiantela merged 2 commits intov3-mainfrom
fix/textarea-auto-height
Apr 17, 2026
Merged

🐛 Launcher Voice Affordance and Textarea Auto-Height#86
cristiantela merged 2 commits intov3-mainfrom
fix/textarea-auto-height

Conversation

@cristiantela
Copy link
Copy Markdown
Collaborator

Description

Type of Change

    • Bugfix
    • Feature
    • Code style update (formatting, local variables)
    • Refactoring (no functional changes, no api changes)
    • Tests
    • Other

Motivation and Context

The launcher treated “voice available” as equivalent to isVoiceEnabledByClient, so the split launcher / voice entry affordance could appear even when voice was not actually startable (for example server disabled, unsupported, or voice already active). That made the UI suggest an action the app would not honor in the same way users expected.

The message input textarea autosize relied on scrollHeight right after layout changes. In some cases scrollHeight was initially 0 (no stable layout yet), which led to incorrect or collapsed height until something else forced a relayout.

Summary of Changes

Launcher (Launcher.jsx)

  • Introduced a memoized canStartVoice flag: client enabled, server enabled, mode supported, and not already in active voice mode.
  • handleGraphicEqClick now uses that shared flag instead of recomputing ad hoc (dependency array simplified accordingly).
  • Launcher layout classes and the hover voice UI are gated with canStartVoice instead of isVoiceEnabledByClient alone, so the “voice” launcher state matches real eligibility (weni-launcher--as-button, hover split with the graphic eq control).

Input (InputBox.jsx)

  • Replaced the textarea height useEffect with useLayoutEffect and a local adjustHeight helper.
  • Subscribed a ResizeObserver on the textarea so height is recalculated when its box size changes (for example after the widget gains real dimensions).
  • Skips applying height when scrollHeight === 0 to avoid locking the field to a zero height before layout is ready.
  • Broadened the effect dependency list so measurement runs again when the textarea is remounted or its context changes (text, inputTextFieldHint, recording / camera / voice page / entering voice mode, mode).
  • If ResizeObserver is unavailable, falls back to a single adjustHeight run without observation.

@cristiantela cristiantela merged commit b7c64ba into v3-main Apr 17, 2026
1 of 2 checks passed
@cristiantela cristiantela deleted the fix/textarea-auto-height branch April 17, 2026 12:21
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.

2 participants