@lumx/react 4.9.0-next.16 → 4.9.0-next.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +12 -10
  2. package/index.js.map +1 -1
  3. package/package.json +3 -3
package/index.js CHANGED
@@ -2498,7 +2498,8 @@ function isOptionDisabled(option) {
2498
2498
  /** Returns true when the cell is NOT the first gridcell in its row (i.e., it's an action cell). */
2499
2499
  function isActionCell(cell) {
2500
2500
  const row = cell.closest('[role="row"]');
2501
- return row?.querySelector('[role="gridcell"]') !== cell;
2501
+ if (!row) return false;
2502
+ return row.querySelector('[role="gridcell"]') !== cell;
2502
2503
  }
2503
2504
 
2504
2505
  /** Predicate matching an option element that carries `aria-selected="true"`. */
@@ -3371,16 +3372,17 @@ function setupCombobox(callbacks, options, onTriggerAttach) {
3371
3372
  switch (event.key) {
3372
3373
  case 'Enter':
3373
3374
  if (handle.isOpen && nav?.hasActiveItem && nav.activeItem) {
3374
- if (!isOptionDisabled(nav.activeItem)) {
3375
- // Click the active item. For option cells, the delegated click handler
3376
- // on the listbox will call handle.select() and handle closing.
3377
- // For action cells and link options, the native click fires too.
3378
- nav.activeItem.click();
3375
+ // Capture activeItem before click — the click handler may close
3376
+ // the popover and clear the focus navigation state.
3377
+ const {
3378
+ activeItem
3379
+ } = nav;
3380
+ // "Click" on active option
3381
+ if (!isOptionDisabled(activeItem)) {
3382
+ activeItem.click();
3379
3383
  }
3380
- // Close for single-select. For option cells the delegated handler
3381
- // already closed, but setIsOpen(false) is idempotent. For action cells
3382
- // and disabled options, the delegated handler did NOT close, so this is needed.
3383
- if (!handle.isMultiSelect) {
3384
+ // Only close when not in multi select and not in action cell
3385
+ if (!handle.isMultiSelect && !isActionCell(activeItem)) {
3384
3386
  handle.setIsOpen(false);
3385
3387
  }
3386
3388
  } else if (!handle.isMultiSelect) {