Skip to content

Commit

Permalink
refactor: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
quanho committed Apr 20, 2023
1 parent 9dbd1f7 commit 853dac5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import renderer from 'react-test-renderer';
import { Grid, Typography } from '@mui/material';
import { createTheme, ThemeProvider } from '@nebula.js/ui/theme';
import Lock from '@nebula.js/ui/icons/lock';
import * as rowsKeyboardNavigation from '../../../interactions/keyboard-navigation/keybord-nav-rows';
import * as rowsKeyboardNavigation from '../../../interactions/keyboard-navigation/keyboard-nav-rows';
import ListBoxCheckbox from '../components/ListBoxCheckbox';
import * as screenReaders from '../../ScreenReaders';
import ListBoxRadioButton from '../components/ListBoxRadioButton';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import KEYS from '../../../../../keys';
import getRowsKeyboardNavigation from '../keybord-nav-rows';
import getRowsKeyboardNavigation from '../keyboard-nav-rows';
import { createElement } from './keyboard-nav-test-utils';

describe('keyboard navigation', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ export default function getRowsKeyboardNavigation({
keyCode === KEYS.ARROW_RIGHT ||
!(typeof rowIndex === 'number' && typeof columnIndex === 'number')
) {
const parentElm = elm && elm.parentElement[next ? 'nextElementSibling' : 'previousElementSibling'];
return parentElm && parentElm.querySelector('[role]');
const parentElm = elm?.parentElement[next ? 'nextElementSibling' : 'previousElementSibling'];
return parentElm?.querySelector('[role]');
}
const gridElm = elm && elm.parentElement.parentElement;
if (gridElm && gridElm.childElementCount) {
const gridElm = elm?.parentElement.parentElement;
if (gridElm?.childElementCount) {
const nextIndex = findNextIndex(keyCode, gridElm.childElementCount);
const nextElm = elm && elm.parentElement.parentElement.children[nextIndex];
return nextElm && nextElm.querySelector('[role]');
const nextElm = elm?.parentElement.parentElement.children[nextIndex];
return nextElm?.querySelector('[role]');
}
return undefined;
};
Expand Down

0 comments on commit 853dac5

Please sign in to comment.