Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebKit内核浏览器上无法正常显示测验中的所有题目 #8

Closed
SkyEye-FAST opened this issue Jul 11, 2024 · 11 comments
Closed
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@SkyEye-FAST
Copy link
Owner

SkyEye-FAST commented Jul 11, 2024

根据控制台的输出,WebKit内核的浏览器无法正常以currentQuestionIndex读取对应的键名。观察到currentQuestionIndex在迭代两次后才会读取键名。

如题组BboQSDTC0aNGamHgFioHNuWKue1z5P

题组(展开可见)
const questionsData = {
	"advancements.nether.create_beacon.title": {
		"source": "Bring Home the Beacon",
		"translation": "带信标回家"
	},
	"block.minecraft.activator_rail": {
		"source": "Activator Rail",
		"translation": "激活铁轨"
	},
	"block.minecraft.andesite_wall": {
		"source": "Andesite Wall",
		"translation": "安山岩墙"
	},
	"block.minecraft.big_dripleaf": {
		"source": "Big Dripleaf",
		"translation": "大型垂滴叶"
	},
	"block.minecraft.dark_oak_sign": {
		"source": "Dark Oak Sign",
		"translation": "深色橡木告示牌"
	},
	"block.minecraft.gravel": {
		"source": "Gravel",
		"translation": "沙砾"
	},
	"block.minecraft.stripped_jungle_wood": {
		"source": "Stripped Jungle Wood",
		"translation": "去皮丛林木"
	},
	"entity.minecraft.evoker": {
		"source": "Evoker",
		"translation": "唤魔者"
	},
	"entity.minecraft.fishing_bobber": {
		"source": "Fishing Bobber",
		"translation": "浮漂"
	},
	"item.minecraft.leather": {
		"source": "Leather",
		"translation": "皮革"
	}
};

正常应当迭代如下:

{
    "0": "advancements.nether.create_beacon.title",
    "1": "block.minecraft.activator_rail",
    "2": "block.minecraft.andesite_wall",
    "3": "block.minecraft.big_dripleaf",
    "4": "block.minecraft.dark_oak_sign",
    "5": "block.minecraft.gravel",
    "6": "block.minecraft.stripped_jungle_wood",
    "7": "entity.minecraft.evoker",
    "8": "entity.minecraft.fishing_bobber",
    "9": "item.minecraft.leather"
}

WebKit内核的浏览器会迭代如下,注释掉的题目不会显示:

{
    "0": "advancements.nether.create_beacon.title",
    "1": "advancements.nether.create_beacon.title",
    // "block.minecraft.activator_rail",
    "2": "block.minecraft.andesite_wall",
    "3": "block.minecraft.andesite_wall",
    // "block.minecraft.big_dripleaf",
    "4": "block.minecraft.dark_oak_sign",
    "5": "block.minecraft.dark_oak_sign",
    // "block.minecraft.gravel",
    "6": "block.minecraft.stripped_jungle_wood",
    "7": "block.minecraft.stripped_jungle_wood",
    // "entity.minecraft.evoker",
    "8": "entity.minecraft.fishing_bobber",
    "9": "entity.minecraft.fishing_bobber"
    // "item.minecraft.leather"
}
@SkyEye-FAST
Copy link
Owner Author

上述迭代的currentQuestionIndex的说明有误,应从0开始。现已更正。

@SkyEye-FAST
Copy link
Owner Author

WebKit内核浏览器已经能够显示所有题目,但是无法正确给box着色。

@SkyEye-FAST SkyEye-FAST changed the title WebKit内核浏览器上无法显示测验中的所有题目 WebKit内核浏览器上无法正常显示测验中的所有题目 Jul 11, 2024
SkyEye-FAST added a commit that referenced this issue Jul 11, 2024
SkyEye-FAST added a commit that referenced this issue Jul 11, 2024
SkyEye-FAST added a commit that referenced this issue Jul 11, 2024
SkyEye-FAST added a commit that referenced this issue Jul 11, 2024
SkyEye-FAST added a commit that referenced this issue Jul 11, 2024
SkyEye-FAST added a commit that referenced this issue Jul 11, 2024
SkyEye-FAST added a commit that referenced this issue Jul 11, 2024
SkyEye-FAST added a commit that referenced this issue Jul 11, 2024
SkyEye-FAST added a commit that referenced this issue Jul 11, 2024
SkyEye-FAST added a commit that referenced this issue Jul 11, 2024
SkyEye-FAST added a commit that referenced this issue Jul 11, 2024
SkyEye-FAST added a commit that referenced this issue Jul 11, 2024
@SkyEye-FAST
Copy link
Owner Author

SkyEye-FAST commented Jul 12, 2024

Fixed in efae8c7.
行为恢复到一开始的状态,误以为修复。

@SkyEye-FAST SkyEye-FAST unpinned this issue Jul 12, 2024
@SkyEye-FAST SkyEye-FAST reopened this Jul 12, 2024
@SkyEye-FAST
Copy link
Owner Author

目前仍然无法正常着色,似乎是setTimeout造成的。

initializeQuestion执行之前,已经执行了currentQuestionIndex++,迭代到下一个题目;这使得当前的输入被判断为不正确,从而不把box显示为绿色。

@SkyEye-FAST
Copy link
Owner Author

改了半天不仅又恢复到原来的状态,现在连summary也显示不出来了……WebKit你真是这个👍

@SkyEye-FAST SkyEye-FAST added the help wanted Extra attention is needed label Jul 12, 2024
@SkyEye-FAST
Copy link
Owner Author

ScreenRecording_07-12-2024.01-31-49_1.mp4
ScreenRecording_07-12-2024.23-13-02_1.mp4

这是目前可能的两种行为:

  1. 不能显示所有题目,但是着色正常。
  2. 能显示所有题目,但是着色不正常。

这两种行为都只在WebKit内核浏览器上出现,相同的代码不会在其他浏览器上复现问题。

@SkyEye-FAST
Copy link
Owner Author

现在已经将更改回退至“能显示所有题目,但是着色不正常”的情况,但是由于修复了 #10 ,行为和前面的录屏又不一致了。

@SkyEye-FAST
Copy link
Owner Author

SkyEye-FAST commented Jul 13, 2024

ScreenRecording_07-13-2024.17-16-18_1.mp4

现在的行为是:

  1. 能够显示所有题目和总结;
  2. 不能在切换时正确着色,即应有的绿色消失;
  3. 切换时inputBoxbox中的文字会被截断为下一道题目的长度。

@SkyEye-FAST
Copy link
Owner Author

先将dev分支的更改合并,以应用 #10 的修复。

@SkyEye-FAST SkyEye-FAST pinned this issue Jul 13, 2024
@SkyEye-FAST SkyEye-FAST added good first issue Good for newcomers and removed good first issue Good for newcomers labels Jul 13, 2024
SkyEye-FAST added a commit that referenced this issue Jul 13, 2024
SkyEye-FAST added a commit that referenced this issue Jul 13, 2024
@SkyEye-FAST
Copy link
Owner Author

ScreenRecording_07-13-2024.23-20-34_1.mp4

引入了async/await,现在WebKit能完全显示正常,但是会自动跳题。

SkyEye-FAST added a commit that referenced this issue Jul 13, 2024
@SkyEye-FAST
Copy link
Owner Author

Fixed in 9d6e8c7.

引入了个简单的锁结构防止WebKit执行两次currentQuestionIndex++,于是一切都正常了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant