-
Notifications
You must be signed in to change notification settings - Fork 165
[terra-list]Fix for terra-menu console error #3935
Conversation
if (listItems[previousIndex]) { | ||
listItems[previousIndex].focus(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes should be tested
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes have tested by creating the tar file with this change on terra-menu . For reference please check the screen recording attached in PR description for pre and post implementation .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, bad wording on my part. I trust that this was tested before submitting 🙂
What I meant was that we should write tests for these to test the condition and any potential edge cases. It can be a unit test or a wdio test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sdadn For this particular scenario not being able to create test :- These functionality can be hard because not being able to assert the focus invocation on null object ,which is making hard to write the test case to justify the changes made on List.jsx.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I thought you could test the condition but that makes sense. If it's not possible, then the screen recording should be good enough. Thanks for trying!
+1
packages/terra-list/CHANGELOG.md
Outdated
@@ -2,6 +2,9 @@ | |||
|
|||
## Unreleased | |||
|
|||
* Fixed | |||
* Fixed the console error appearing in the terra-menu examples while keyboard navigation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the errors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following is the error getting while navigating through arrow key (https://engineering.cerner.com/terra-framework/components/cerner-terra-framework-docs/menu/menu) :-
Uncaught TypeError: Cannot read properties of undefined (reading 'focus')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can rephrase this to:
Fixed _property is undefined_ error while navigating with a keyboard.
Summary
What was changed:
Implemented the condition before focus to handle undefined value condition
Why it was changed:
User is getting Errors when navigating using arrow keys on terra-menu.
Testing
This change was tested using:
Reviews
In addition to engineering reviews, this PR needs:
Additional Details
This PR resolves:
UXPLATFORM-9738
Pre implementation:-
Screen.Recording.2023-10-12.at.12.30.57.PM.mov
Post implementation:-
Screen.Recording.2023-10-12.at.12.33.04.PM.mov
Thank you for contributing to Terra.
@cerner/terra