Fix multiple text tracks being selectable in the language menu - #189
Merged
Merged
Conversation
Fixes #187 Co-Authored-By: Mattias Buelens <mattias.buelens@dolby.com>
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
🦋 Changeset detectedLatest commit: 18d1f8a The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Co-Authored-By: Mattias Buelens <mattias.buelens@dolby.com>
ceyhun-o
approved these changes
Sep 16, 2026
MattiasBuelens
deleted the
devin/1789538074-fix-multiple-text-tracks
branch
September 16, 2026 09:52
Merged
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 #187: selecting a second subtitle track in
<theoplayer-language-menu>did not deselect the first one, so multiple tracks were shown at the same time.This worked in v1 and regressed in v2 with the introduction of
RadioGroup.value(bc8188e). In v2,_onButtonChangeonly didthis.value = button.value. Track buttons (TextTrackRadioButton,TextTrackOffRadioButton,MediaTrackRadioButton) do not set avalue, so they all shareundefined. Thevaluesetter returns early when the value is unchanged, and never unchecks the previously checked button.Fix in
RadioGroup:private readonly _onButtonChange = (event: Event) => { const button = event.target as RadioButton | null; - if (button !== null && button.checked) { - this.value = button.value; - } + if (button === null || !button.checked) return; + this._value = button.value; + this.setCheckedRadioButton(button); // always uncheck the other buttons, like v1 did + this.dispatchEvent(createEvent('change', { bubbles: true })); }; private updateCheckedButton(): void { + if (this._value === undefined) return; // value-less buttons manage their own checked state ... }The guard in
updateCheckedButton()preventsfind(b => b.value == undefined)from checking the first (e.g. "Off") button on slot change, which would otherwise disable a track that is showing by default.Groups with explicit values (
PlaybackRateRadioGroup, text track style menus) are unaffected: theirvaluesetter still drivesupdateCheckedButton().Verification
npm run test:format,test:typecheck,test:unit,build:debugpass.examples/default-ui.htmland a source with two WebVTT tracks (English, German): before the fix, clicking English then German left both tracksshowing; after the fix only the last clicked track isshowing, and "Off" disables both. A track withdefault: truestays selected on load.Link to Devin session: https://dolby.devinenterprise.com/sessions/4a87b8e21d9344fc8c5e6a918b5ab471
Open in Devin Desktop: https://dolby.devinenterprise.com/desktop/session/4a87b8e21d9344fc8c5e6a918b5ab471?variant=devin
Requested by: @MattiasBuelens