@jsenv/navi 0.29.48 → 0.29.49

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.
@@ -52307,9 +52307,16 @@ const PickerCustom = props => {
52307
52307
  const pickerEl = ref.current;
52308
52308
  const inputEl = getPickerInput(pickerEl);
52309
52309
  const valueAtClose = getUIStateFromElement(inputEl);
52310
- if (heldAtOpen && compareTwoJsValues(valueAtClose, valueAtOpen)) {
52311
- // Value unchanged and already held closing on it says nothing
52312
- // new. No action to run, but still allow the close.
52310
+ if (compareTwoJsValues(valueAtClose, valueAtOpen) && (heldAtOpen || valueAtOpen === undefined)) {
52311
+ // Nothing to say on the way out, for one of two reasons. Either the
52312
+ // value was already held and has not moved closing on it repeats
52313
+ // what was already the answer. Or there was never anything to
52314
+ // confirm: a picker holding nothing AND showing nothing (a menu of
52315
+ // gestures — no value, no defaultValue, no signal) has no
52316
+ // suggestion to accept, and confirming `undefined` cannot mean
52317
+ // anything. A picker on a defaultValue is untouched by this: it
52318
+ // shows something, so closing on it still confirms it.
52319
+ // No action to run, but still allow the close.
52313
52320
  return;
52314
52321
  }
52315
52322
  dispatchRequestAction(inputEl, {
@@ -52340,8 +52347,17 @@ const PickerCustom = props => {
52340
52347
  // answer. Say it here — this is the moment the suggestion becomes
52341
52348
  // one. Harmless when the value did change on the way: the state is
52342
52349
  // already what it is, and this only re-runs the same reaction.
52343
- debugPopup(closeEvent, `picker defined a suggestion -> commit it`);
52344
- commitUIStateAsAnswer(getPickerInput(ref.current)?.__uiStateController__, closeEvent);
52350
+ const inputEl = getPickerInput(ref.current);
52351
+ const valueAtClose = getUIStateFromElement(inputEl);
52352
+ if (valueAtOpen === undefined && compareTwoJsValues(valueAtClose, valueAtOpen)) {
52353
+ // Same third case onRequestClose steps around: nothing held,
52354
+ // nothing shown, nothing picked. There is no suggestion here to
52355
+ // turn into an answer.
52356
+ debugPopup(closeEvent, `picker showed nothing -> nothing to commit`);
52357
+ } else {
52358
+ debugPopup(closeEvent, `picker defined a suggestion -> commit it`);
52359
+ commitUIStateAsAnswer(inputEl?.__uiStateController__, closeEvent);
52360
+ }
52345
52361
  }
52346
52362
  leaveExpanded({
52347
52363
  isBack: closeEvent.detail.isCancel