material-react-table-narender 2.13.6 → 2.13.8

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -594,15 +594,34 @@ const cellKeyboardShortcuts = ({ cell, cellElements, cellValue, containerElement
594
594
  'PageDown',
595
595
  ].includes(event.key)) {
596
596
  event.preventDefault();
597
- if (['ArrowDown'].includes(event.key)) {
598
- debugger; // This will pause execution for debugging purposes
599
- // Select the input element within the MUI Autocomplete component
597
+ // if (['ArrowDown'].includes(event.key)) {
598
+ // debugger; // This will pause execution for debugging purposes
599
+ // // Select the input element within the MUI Autocomplete component
600
+ // const autocomplete = currentCell.querySelector('.MuiAutocomplete-root input[type="text"]');
601
+ // // Check if the current cell is an MUI Autocomplete
602
+ // if (autocomplete) {
603
+ // return; // Exit the function if it's an Autocomplete
604
+ // }
605
+ // // Additional logic for when it's not an Autocomplete can go here
606
+ // }
607
+ if (['ArrowDown', 'ArrowUp'].includes(event.key)) {
600
608
  const autocomplete = currentCell.querySelector('.MuiAutocomplete-root input[type="text"]');
601
- // Check if the current cell is an MUI Autocomplete
602
- if (autocomplete) {
603
- return; // Exit the function if it's an Autocomplete
609
+ // Check if the autocomplete input exists and is focused
610
+ if (autocomplete && document.activeElement === autocomplete) {
611
+ if (event.key === 'ArrowDown') {
612
+ // Do something with the autocomplete input
613
+ console.log('Autocomplete input found and is focused:', autocomplete);
614
+ return; // Exit if it's an Autocomplete and it is focused
615
+ }
616
+ if (event.key === 'ArrowUp') {
617
+ // check if the autocomplete is open
618
+ const autocompleteList = currentCell.querySelector('.MuiAutocomplete-popper');
619
+ if (autocompleteList) {
620
+ return;
621
+ }
622
+ }
604
623
  }
605
- // Additional logic for when it's not an Autocomplete can go here
624
+ // Additional logic if not an Autocomplete or not focused
606
625
  }
607
626
  const currentRow = parentElement || currentCell.closest('tr');
608
627
  const tableElement = containerElement || currentCell.closest('table');