MCPcopy Create free account
hub / github.com/adobe/react-spectrum / commitValue

Function commitValue

packages/react-stately/src/combobox/useComboBoxState.ts:553–562  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

551 };
552
553 const commitValue = () => {
554 if (allowsCustomValue) {
555 const itemText =
556 selectedKey != null ? (collection.getItem(selectedKey)?.textValue ?? '') : '';
557 inputValue === itemText ? commitSelection() : commitCustomValue();
558 } else {
559 // Reset inputValue and close menu
560 commitSelection();
561 }
562 };
563
564 let commit = () => {
565 if (triggerState.isOpen && selectionManager.focusedKey != null) {

Callers 2

commitFunction · 0.70
setFocusedFunction · 0.70

Calls 3

commitCustomValueFunction · 0.85
commitSelectionFunction · 0.70
getItemMethod · 0.65

Tested by

no test coverage detected