Skip to content

fix(tts): EdgeTTS UX polish — dropdown animation, voice selector sync, default voice#12

Merged
chyinan merged 4 commits intochyinan:mainfrom
aegbirou:feat/edge-tts
Apr 6, 2026
Merged

fix(tts): EdgeTTS UX polish — dropdown animation, voice selector sync, default voice#12
chyinan merged 4 commits intochyinan:mainfrom
aegbirou:feat/edge-tts

Conversation

@aegbirou
Copy link
Copy Markdown

@aegbirou aegbirou commented Apr 5, 2026

Summary / 概述

Polish and bug-fix pass on the EdgeTTS integration introduced in the previous commit.
Fixes three UX issues (macOS dropdown animation glitch, voice selector disappearing when provider is active, wrong default voice selection) and bumps the underlying edge-tts-rust crate.

Changes / 变更内容

  • fix: macOS dropdown fly-in animation — The custom Select portal rendered at {top:0, left:0} on the first frame (coords were {0,0} until a useEffect ran), causing the dropdown to briefly appear at the top-left corner and triggering the entry animation from there. Fixed by computing the position synchronously inside handleToggle so React batches all state updates into a single render.

  • fix: EdgeTTS voice selector always visible in edit form — The voice <Select> inside the provider edit panel was hidden whenever that provider was the active one (provider.id !== ttsProviderId guard). This left the edit form completely empty for EdgeTTS (which has no other config fields) and made the selector appear/disappear unpredictably. Now the selector is always shown: when the provider is active it binds to ttsVoice/onTtsVoiceChange (keeping both panels in sync); when inactive it writes default_voice as before. First-add state (voices not yet loaded) shows a hint text instead of a broken empty dropdown.

  • fix: default voice falling back to Spanish / first-alphabetical voice — When a newly added EdgeTTS provider had no default_voice set, normalizeTtsVoice fell back to voices.find(...) which returned the first entry in the alphabetically-sorted voice list (Afrikaans → Arabic → … → Spanish → … → Chinese). Fixed in two places: (1) addProvider now seeds default_voice: "zh-CN-XiaoyiNeural" at creation time; (2) both fallback branches in normalizeTtsVoice prefer zh-CN-XiaoyiNeural (matching the Rust backend constant) before giving up to the raw array.

  • chore: upgrade edge-tts-rust 0.1.2 → 0.1.3

Type / 类型

  • feat — New feature / 新功能
  • fix — Bug fix / Bug 修复
  • refactor — Code refactoring / 代码重构
  • docs — Documentation / 文档
  • style — UI/CSS changes / 界面样式
  • test — Tests / 测试
  • chore — Build/tooling / 构建工具

Testing / 测试

  • npm run tauri dev runs without errors
  • npx tsc --noEmit passes
  • cargo check passes
  • Manually tested the feature

Screenshots / 截图

Related Issues / 相关 Issue

Initsnow and others added 4 commits April 6, 2026 01:58
Compute portal coordinates synchronously in handleToggle before
calling setOpen, so React batches all state updates into a single
render and the dropdown's first paint is already at the correct
position.

Previously, coords initialized to {0,0} and were only updated by a
useEffect on the next tick, causing the portal to briefly appear at
the top-left corner before jumping to the correct spot. On macOS
WebKit the GPU compositor renders that stale frame visibly, producing
the fly-in artifact. Windows/Linux WebView2 tends to discard it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove the `provider.id !== ttsProviderId` guard so the voice
  dropdown is always visible in the EdgeTTS / OpenAI edit form
- When the provider is active, the selector binds to `ttsVoice` /
  `onTtsVoiceChange` so both sections stay in sync
- When inactive, it still writes to `provider.default_voice` as before
- Replace the misleading "no available voices" Select with a plain hint
  text when voices haven't loaded yet (first add before save+refresh)
- Add i18n keys: manage_providers.active / voices_after_save (zh/en/ja/ko)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…t alphabetical

Two-part fix:
1. TtsTab addProvider: seed default_voice on new edge_tts / openai
   providers at creation time so normalizeTtsVoice always finds a
   configured value and never hits the raw array fallback.
2. normalizeTtsVoice (both empty-voice and no-match branches): when
   default_voice is absent, prefer zh-CN-XiaoyiNeural (matching the
   Rust backend constant) over voices.find() which returned whatever
   locale sorts first alphabetically (Afrikaans / Arabic / Spanish…).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 5, 2026

❌ API 错误:Error code: 402 - {'error': {'message': '余额不足,请充值后继续使用', 'balance': -0.39923132853442767}}

@chyinan
Copy link
Copy Markdown
Owner

chyinan commented Apr 6, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

Generated with Claude Code

@chyinan chyinan merged commit 0162077 into chyinan:main Apr 6, 2026
7 checks passed
@aegbirou aegbirou deleted the feat/edge-tts branch April 8, 2026 07:07
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