Repository navigation
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.
问题
display: contents且文字直接放在容器里时,本页翻译已经能认出这段。排队仍看元素自己的盒子,并用IntersectionObserver维护附近集合。当前 Chrome 里这种元素自己的盒子是原点上的 0×0,观察器回报不与视口相交,随后把它从附近集合删掉。短页面有时还能发出第一批;后面的分块,以及视口里已经有够多正常段落时,这段就一直待译。屏幕外的这种段落也会因为盒子在原点而被当成很近。#73 已经让单词提示和句子结构改看内容盒子。本页翻译的附近队列还没有。
方案
这种容器的附近范围改看文字盒子。观察器报不相交时,滚动仍按内容位置把段落收回或排除。普通元素继续用自己的盒子。
产品影响
只改变这种容器的本页翻译排队。屏幕内的会译,屏幕外的不会抢名额。不扩大默认分析范围。
数据与权限
发送范围、权限和缓存规则不变。屏幕外的这种段落不再因为零盒子被发出;屏幕内的会按原批次发出。
验证
bun test tests/content-assistance-feedback.test.js:64 pass,0 fail。覆盖:观察器漏报后仍译出后续分块;内容在屏幕外时不进入第一批。
文档
docs/development/architecture.md在 #73 那句后面补了本页翻译队列。