mirror of
https://github.com/kennethreitz/kjvstudy.org.git
synced 2026-06-05 23:00:16 +00:00
Fix left/right arrow expand/collapse logic
Now checks actual DOM state instead of collapsedNodes set, which fixes behavior with depth-based auto-collapse. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -762,7 +762,9 @@ document.addEventListener('keydown', (e) => {
|
||||
e.preventDefault();
|
||||
if (selectedIndex >= 0 && selectedIndex < visibleNodes.length) {
|
||||
const id = visibleNodes[selectedIndex].dataset.id;
|
||||
if (collapsedNodes.has(id)) {
|
||||
const childContainer = document.querySelector(`.children-container[data-parent="${id}"]`);
|
||||
// Expand if currently collapsed
|
||||
if (childContainer && childContainer.classList.contains('collapsed')) {
|
||||
toggleNode(id);
|
||||
}
|
||||
}
|
||||
@@ -773,14 +775,10 @@ document.addEventListener('keydown', (e) => {
|
||||
e.preventDefault();
|
||||
if (selectedIndex >= 0 && selectedIndex < visibleNodes.length) {
|
||||
const id = visibleNodes[selectedIndex].dataset.id;
|
||||
if (!collapsedNodes.has(id)) {
|
||||
const person = familyTreeData[id];
|
||||
const hasExpandable = currentRoot === 'jesus'
|
||||
? (person.parents && person.parents.length > 0)
|
||||
: (person.children && person.children.length > 0);
|
||||
if (hasExpandable) {
|
||||
toggleNode(id);
|
||||
}
|
||||
const childContainer = document.querySelector(`.children-container[data-parent="${id}"]`);
|
||||
// Collapse if currently expanded
|
||||
if (childContainer && !childContainer.classList.contains('collapsed')) {
|
||||
toggleNode(id);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user