Detecting focus? Bullet Threading

As a former Logseq user, I love writing my daily notes in an outline format (basically bunch of collapsible, nested lists).

When a certain topic becomes quite long or deeply nested, then it’s useful to see a trace going back to parent bullets, much like the Bullet Threading plugin in Logseq.

When trying to mimic this, I couldn’t figure out how to detect when the cursor is on a specific line. Pseudoselectors like :active, :focus and :focus-within don’t trigger or only trigger briefly on clicking the line.

Does anyone know if this is possible?

I am not sure but maybe this could help? @zef