Uncollapsing grandparent makes children of collapsed comment visible
qsantos opened this issue · comments
Quentin Santos commented
This is actually a bug of Hacker News, but should be addressed by ViHN
Quentin Santos commented
To reproduce:
- locate a grandchild comment C that has children of its own
- collapse comment C
- collapse comment C's grandparent
- uncollapse comment C's grandparents
Comment C is still collapsed, as expected. However, rhe children of comment C are visible. They should not be since comment C is collapsed.
Quentin Santos commented
https://news.ycombinator.com/item?id=39498281#39515468 can be used as “comment C”
Quentin Santos commented
The bug was introduced on 2021-09-02:
Quentin Santos commented
Quentin Santos commented
Reproduction:
Hacker.News.bug.mp4
Quentin Santos commented
Corresponding patch for Hacker News:
diff --git a/hn.js b/hn.js
index 946eda9..a1ae174 100644
--- a/hn.js
+++ b/hn.js
@@ -59,11 +59,10 @@ function kidvis (tr, show) {
break;
} else if (!show) {
setshow(tr, false);
- } else if (ind(tr) == n) {
+ } else if (!coll || ind(tr) <= n) {
+ n = ind(tr);
coll = hasClass(tr, 'coll');
setshow(tr, true);
- } else if (!coll) {
- setshow(tr, true);
}
}
}