@patternfly/react-templates 6.5.0-prerelease.3 → 6.5.0-prerelease.31

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.
@@ -195,13 +195,20 @@ export const TypeaheadSelectBase: FunctionComponent<TypeaheadSelectProps> = ({
195
195
  }
196
196
  };
197
197
 
198
- const closeMenu = () => {
198
+ const closeMenu = (shouldRestoreInput = true) => {
199
199
  onToggle && onToggle(false);
200
200
  setIsOpen(false);
201
201
  resetActiveAndFocusedItem();
202
- const option = initialOptions.find((o) => o.value === selected);
203
- if (option) {
204
- setInputValue(String(option.content));
202
+
203
+ // Only restore input value when user cancels (doesn't select)
204
+ // Don't restore when explicitly selecting an option (handled by selectOption)
205
+ if (shouldRestoreInput) {
206
+ const option = initialOptions.find((o) => o.value === selected);
207
+ if (option) {
208
+ setInputValue(String(option.content));
209
+ }
210
+ // Clear filter when closing without selecting to show all options on next open
211
+ setFilterValue('');
205
212
  }
206
213
  };
207
214
 
@@ -223,7 +230,7 @@ export const TypeaheadSelectBase: FunctionComponent<TypeaheadSelectProps> = ({
223
230
  setFilterValue('');
224
231
  setSelected(String(option.value));
225
232
 
226
- closeMenu();
233
+ closeMenu(false); // Don't restore - we just set the correct value above
227
234
  };
228
235
 
229
236
  const _onSelect = (_event: ReactMouseEvent<Element, MouseEvent> | undefined, value: string | number | undefined) => {