Repository navigation
fix(media): 全屏后保持媒体暗色作用域 - #1980
Merged
Merged
Conversation
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.
变更概述
修复视频全屏后画面背景变回应用主题色:全屏时把媒体主题作用域同步到播放器元素本身,元素被搬移到
body后作用域仍随行。关联 Issue
Fixes #1979
根因
ArtPlayer 的
FULLSCREEN_WEB_IN_BODY默认为true,进入网页全屏时把.art-video-player移到document.body;data-media-theme="dark"留在原VideoPlayer根节点,元素脱离作用域后回落到应用主题 token。修复
VideoPlayer新增一个同步 effect:按mediaTheme在art.template.$player上设置/移除data-media-theme。属性随元素一起被搬到body,全屏背景继续解析为暗色;跟随档不设属性,仍随应用主题。未关闭FULLSCREEN_WEB_IN_BODY,保留 ArtPlayer 的全屏定位与遮挡处理。验证
修复前(红证据,票面原始输出):全屏后父节点
BODY、背景rgb(247,247,246)、无属性。修复后:
rgb(19,19,22)darkrgb(19,19,22)darkrgb(247,247,246)rgb(247,247,246)npx playwright test e2e/player-theme.spec.ts:8 passed(含 2 条全屏回归/对照)npx tsc --noEmit:通过npx eslint src/components/Content/VideoPlayer.tsx e2e/player-theme.spec.ts:0 error.artifacts/1979/state-coverage.json4 态,截图与断言均 passed质量门禁引用
风险评估
风险等级: low
来源: ai-generated
单文件属性同步,不改全屏机制;回滚为 revert 本提交。
回滚方案
git revert <merge-commit>。