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

Bug: sbb-menu, using keys to navigate produces error #1874

Closed
kyubisation opened this issue Jul 14, 2023 · 0 comments · Fixed by #1882
Closed

Bug: sbb-menu, using keys to navigate produces error #1874

kyubisation opened this issue Jul 14, 2023 · 0 comments · Fixed by #1882
Assignees

Comments

@kyubisation
Copy link
Contributor

TypeError: Cannot read properties of undefined (reading 'focus')
at SbbMenu.handleKeyDown (sbb-menu.entry.js:93:1)
at HostElement.eval (index-6bc740f4.js:1892:1)
at HostElement.nrWrapper (de:6:15742) undefined

Happened on beta.sbb.ch in language chose menu -> they have own list implementation, maybe related?

Caused in:

handleKeyDown(evt) {
if (!isArrowKeyPressed(evt)) {
return;
}
evt.preventDefault();
const enabledActions = Array.from(this._element.children).filter((e) => e.tabIndex === 0);
const current = enabledActions.findIndex((e) => e === evt.target);
const nextIndex = getNextElementIndex(evt, current, enabledActions.length);
enabledActions[nextIndex].focus();
}

@kyubisation kyubisation created this issue from a note in ESTA Web Design System (Next) Jul 14, 2023
@dauriamarco dauriamarco self-assigned this Jul 17, 2023
@dauriamarco dauriamarco moved this from Next to In progress in ESTA Web Design System Jul 18, 2023
ESTA Web Design System automation moved this from In progress to Done Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants