Skip to content

fix(FEC-14966) - Add arrow key navigation and selection for True/Fals… - #206

Merged
valentinStoicaK merged 2 commits into
masterfrom
FEC-14966-focus-doesnt-move-when-using-up-down-arrow-between-quiz-anwsers-options-of-true-false-questions
Jun 8, 2026
Merged

fix(FEC-14966) - Add arrow key navigation and selection for True/Fals…#206
valentinStoicaK merged 2 commits into
masterfrom
FEC-14966-focus-doesnt-move-when-using-up-down-arrow-between-quiz-anwsers-options-of-true-false-questions

Conversation

@valentinStoicaK

Copy link
Copy Markdown
Contributor

This fixes https://kaltura.atlassian.net/browse/FEC-14966 by adding arrow key navigation for True-False questions as it is for Multi-choice questions

Comment on lines +46 to +47
const navigateAndSelect = (currentIndex: number, direction: 'prev' | 'next') => {
const newIndex = direction === 'prev' ? currentIndex - 1 : currentIndex + 1;

@roeedean roeedean Jun 5, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion - not a blocker:
direction: 'prev' | 'next' could be replaced with a numeric var like step: -1 | 1.

Suggested change
const navigateAndSelect = (currentIndex: number, direction: 'prev' | 'next') => {
const newIndex = direction === 'prev' ? currentIndex - 1 : currentIndex + 1;
const navigateAndSelect = (currentIndex: number, step: -1 | 1) => {
const newIndex = currentIndex + step;

This is more direct and avoids the string comparison.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. Done!

Comment on lines +55 to +58
const handleLeftKeyPressed = (currentIndex: number) => navigateAndSelect(currentIndex, 'prev');
const handleRightKeyPressed = (currentIndex: number) => navigateAndSelect(currentIndex, 'next');
const handleUpKeyPressed = (currentIndex: number) => navigateAndSelect(currentIndex, 'prev');
const handleDownKeyPressed = (currentIndex: number) => navigateAndSelect(currentIndex, 'next');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you decide to go with my suggestion above for func navigateAndSelect - update second var on each call:

'prev' -> -1
'next' -> 1

@valentinStoicaK
valentinStoicaK requested a review from roeedean June 5, 2026 12:03
@valentinStoicaK
valentinStoicaK merged commit 699a216 into master Jun 8, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants