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

Improve keyboard navigation with nodes positions #255

Closed
PierreDemailly opened this issue Nov 25, 2023 · 2 comments · Fixed by #297
Closed

Improve keyboard navigation with nodes positions #255

PierreDemailly opened this issue Nov 25, 2023 · 2 comments · Fixed by #297
Assignees
Labels
good first issue Good for newcomers

Comments

@PierreDemailly
Copy link
Member

Keyboard navigation has been introduced in #254

The problem is that previous/next nodes (when using ArrowLeft / ArrowRight) are based on node IDs.

What does it mean?

Take a look at this image:
image
1, 2 & 3 represent the node ID (it's fake IDs here, just for example)

@topcli/prompts (root node) is focused, if we press ArrowUp then it focuses the first node (@topcli/wcwidth), alright. But then, if we press ArrowRight it will focus on the 2nd node (is-unicode-supported).

We should calculate node position and then focus on the nearest node (or the farthest: in the above example, when node 1 is focused, if we press ArrowLeft because there is no node on the left then it should focus the node one most on the right).

Node positions can be retrievied with
[...secureDataSet.linker].map(([id, opt]) => [id, { ...opt, position: nsn.network.getPosition(id) }])
image

@PierreDemailly PierreDemailly added the good first issue Good for newcomers label Nov 25, 2023
@JusteenR
Copy link

Hi @PierreDemailly I was interested in working on this issue and I was wondering if you could assign it to me?

@PierreDemailly
Copy link
Member Author

Hi @PierreDemailly I was interested in working on this issue and I was wondering if you could assign it to me?

Sure, thanks you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants