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.esm.js CHANGED
@@ -503,15 +503,34 @@ const cellKeyboardShortcuts = ({ cell, cellElements, cellValue, containerElement
503
503
  'PageDown',
504
504
  ].includes(event.key)) {
505
505
  event.preventDefault();
506
- if (['ArrowDown'].includes(event.key)) {
507
- debugger; // This will pause execution for debugging purposes
508
- // Select the input element within the MUI Autocomplete component
506
+ // if (['ArrowDown'].includes(event.key)) {
507
+ // debugger; // This will pause execution for debugging purposes
508
+ // // Select the input element within the MUI Autocomplete component
509
+ // const autocomplete = currentCell.querySelector('.MuiAutocomplete-root input[type="text"]');
510
+ // // Check if the current cell is an MUI Autocomplete
511
+ // if (autocomplete) {
512
+ // return; // Exit the function if it's an Autocomplete
513
+ // }
514
+ // // Additional logic for when it's not an Autocomplete can go here
515
+ // }
516
+ if (['ArrowDown', 'ArrowUp'].includes(event.key)) {
509
517
  const autocomplete = currentCell.querySelector('.MuiAutocomplete-root input[type="text"]');
510
- // Check if the current cell is an MUI Autocomplete
511
- if (autocomplete) {
512
- return; // Exit the function if it's an Autocomplete
518
+ // Check if the autocomplete input exists and is focused
519
+ if (autocomplete && document.activeElement === autocomplete) {
520
+ if (event.key === 'ArrowDown') {
521
+ // Do something with the autocomplete input
522
+ console.log('Autocomplete input found and is focused:', autocomplete);
523
+ return; // Exit if it's an Autocomplete and it is focused
524
+ }
525
+ if (event.key === 'ArrowUp') {
526
+ // check if the autocomplete is open
527
+ const autocompleteList = currentCell.querySelector('.MuiAutocomplete-popper');
528
+ if (autocompleteList) {
529
+ return;
530
+ }
531
+ }
513
532
  }
514
- // Additional logic for when it's not an Autocomplete can go here
533
+ // Additional logic if not an Autocomplete or not focused
515
534
  }
516
535
  const currentRow = parentElement || currentCell.closest('tr');
517
536
  const tableElement = containerElement || currentCell.closest('table');