Skip to content

fix: video transcript language selector scrolling and upload retry - #7

Closed
bra-i-am wants to merge 4 commits into
masterfrom
fix/video-transcript-language-selector
Closed

bra-i-am wants to merge 4 commits into
masterfrom
fix/video-transcript-language-selector

Conversation

@bra-i-am

Copy link
Copy Markdown

Summary

Fixes two problems in the video editor's Transcripts section: the language dropdown scrolled the whole page, and an unset transcript stopped accepting uploads once the author cancelled the file picker.

The dropdown scrolls inside itself, using the same height as the Files & Videos language picker:

 <LanguageSelector>
-  <Dropdown.Menu>
+  <Dropdown.Menu className="transcript-language-select-menu">   # max-height 275px, overflow-y auto, overscroll contain

Choosing a language now checks the saved language to decide between "upload" and "change language", instead of local UI state that changes even when the upload is cancelled:

 onSelectLanguage(newLang)
   pendingUploadLang = newLang
-  if localLang == ''          # already 'es' after a cancelled picker
+  if savedLanguage == ''      # still '' until an upload succeeds
     open file picker
     return
   updateTranscriptLanguage(languageBeforeChange: savedLanguage, newLang)

Before the fix, after a cancel, the next choice took the "change language" path. It fetched a transcript that didn't exist, failed quietly, and the picker never reopened.

The shared FileInput also clears its value after each selection, so picking the same .srt again after a failed upload starts a new upload.

Evidence

  • Before:
    After:

  • Before: LanguageSelector test failed (picker opened 1 time, expected 2)
    After: passes

    on an unset transcript
      choose language → cancel picker → choose same language
        expect file picker opened twice
        expect no updateTranscriptLanguage dispatched
      choose A → cancel → choose B → pick file
        expect uploadTranscript called with language B
    
  • Before: FileInput test failed (input value stayed C:\fakepath\captions.srt)
    After: passes; the value is '' after an upload, and picking the same file again calls onAddFile again

  • Regression guard: changing the language of an uploaded transcript still dispatches updateTranscriptLanguage({ newLanguageCode, languageBeforeChange }) with the right languages.

  • npm test -- src/editors and npm run types pass. Lint passes on the touched files. The repo-wide npm run lint already reports no-floating-promises errors on master, all in data/apiHooks.ts files this PR doesn't touch.

Merge Danger

Door: two-way

No data, API or Redux changes. Reverting the PR restores the old behavior.

Blast Radius: small

  • The new menu styles apply only to the video editor's transcript language dropdown.
  • Clearing the value in FileInput also affects the transcript "Replace" action (TranscriptActionMenu): replacing a transcript with the same file twice now works. Handout, Thumbnail and image uploads render FileInput but use their own hooks, so they're unaffected.
  • Out of scope: LanguageSelector.jsx and FileInput/index.jsx are still legacy .jsx with propTypes. Converting them is left for a follow-up.

Role affected: Course Author

🤖 Generated with Claude Code

bra-i-am and others added 4 commits October 23, 2026 15:06
The transcript language menu in the video editor listed every language
with no height limit, so scrolling moved the page instead of the list.
Cap it at 275px (matching the Files & Videos language picker) and keep
scrolling contained in the menu.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…picker

The transcript language selector chose between "upload" and "change
language" using its local UI state, which a selection updates even when
the file picker is then cancelled. The next selection on the still-unset
transcript took the change-language path and the picker never reopened.
Decide from the saved language instead; local state now only remembers
which language the next upload is for.

Also clear the shared file input's value after each selection so picking
the same file again (e.g. after a failed upload) starts a new upload.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Rename localLang state to pendingUploadLang to reflect its only job.
- Assert the exact before/after languages dispatched on language change.
- Split the cancel-then-same-language test and drop incidental asserts so
  each test checks one behavior.
- Use @src/testUtils render/userEvent/initializeMocks in FileInput tests.
- Note that the 275px menu height matches the Files & Videos picker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l stylesheet

Reuse the existing VideoSettingsModal/index.scss instead of a dedicated
LanguageSelector.scss file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bra-i-am

Copy link
Copy Markdown
Author

Superseded by openedx#3331.

@bra-i-am bra-i-am closed this Oct 26, 2026
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.

1 participant