Skip to content

Commit be2f4b6

Browse files
committed
Do not clear input value on focus
1 parent d6af26c commit be2f4b6

File tree

6 files changed

+8
-18
lines changed

6 files changed

+8
-18
lines changed

.github/workflows/chromatic.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ jobs:
1212
runs-on: ubuntu-latest
1313
# the list of steps that the action will go through
1414
steps:
15+
- uses: actions/setup-node@v3
16+
with:
17+
node-version: '16.20.0'
1518
- uses: actions/checkout@v1
1619
- run: yarn
1720
#- run: yarn build-storybook

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"watch": "rollup -c -w",
2020
"typecheck": "tsc",
2121
"lint": "eslint --rule 'import/no-unresolved: 0' 'src/**/*.[tj]s?(x)'",
22-
"storybook": "start-storybook -p 6006",
22+
"storybook": "export SET NODE_OPTIONS=--openssl-legacy-provider && start-storybook -p 6006",
2323
"build-storybook": "build-storybook"
2424
},
2525
"repository": {

src/components/MultiSelectInput/SearchMultiSelectInput.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ export type SearchMultiSelectInputProps<
7575
| 'onSearchTextChange'
7676
| 'dropdownShown'
7777
| 'onDropdownShownChange'
78-
| 'focused'
79-
| 'onFocusedChange'
8078
| 'focusedKey'
8179
| 'onFocusedKeyChange'
8280
| 'hasValue'
@@ -298,8 +296,6 @@ function SearchMultiSelectInput<
298296
onSearchTextChange={handleSearchValueChange}
299297
dropdownShown={showDropdown}
300298
onDropdownShownChange={handleChangeDropdown}
301-
focused={focused}
302-
onFocusedChange={setFocused}
303299
focusedKey={focusedKey}
304300
onFocusedKeyChange={setFocusedKey}
305301
persistentOptionPopup

src/components/RawTextArea/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function RawTextArea<K extends string>(
8484
value={value ?? ''}
8585
autoComplete="off"
8686
style={style as React.ComponentProps<typeof TextareaAutosize>['style']}
87-
disabled={disabled || readOnly}
87+
disabled={disabled}
8888
readOnly={readOnly}
8989
minRows={3}
9090
maxRows={10}

src/components/SelectInput/SearchSelectInput.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ export type SearchSelectInputProps<
7272
| 'onSearchTextChange'
7373
| 'dropdownShown'
7474
| 'onDropdownShownChange'
75-
| 'focused'
76-
| 'onFocusedChange'
7775
| 'focusedKey'
7876
| 'onFocusedKeyChange'
7977
| 'hasValue'
@@ -259,7 +257,8 @@ function SearchSelectInput<
259257
const handleClear = useCallback(
260258
() => {
261259
if (!props.nonClearable) {
262-
props.onChange(undefined, name, undefined);
260+
const onChangeFromProps = props.onChange;
261+
onChangeFromProps(undefined, name, undefined);
263262
}
264263
},
265264
// eslint-disable-next-line react/destructuring-assignment
@@ -284,8 +283,6 @@ function SearchSelectInput<
284283
onSearchTextChange={handleSearchValueChange}
285284
dropdownShown={showDropdown}
286285
onDropdownShownChange={handleChangeDropdown}
287-
focused={focused}
288-
onFocusedChange={setFocused}
289286
focusedKey={focusedKey}
290287
onFocusedKeyChange={setFocusedKey}
291288
hasValue={isDefined(value)}

src/components/SelectInputContainer/index.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ export type SelectInputContainerProps<
5353
onOptionClick: (optionKey: OK, option: O, name: N) => void;
5454
dropdownShown: boolean;
5555
onDropdownShownChange: (value: boolean) => void;
56-
focused: boolean;
57-
onFocusedChange: (value: boolean) => void;
5856
focusedKey: { key: OK, mouse?: boolean } | undefined;
5957
onFocusedKeyChange: (value: { key: OK, mouse?: boolean } | undefined) => void;
6058
searchText: string;
@@ -126,10 +124,8 @@ function SelectInputContainer<OK extends OptionKey, N extends string, O extends
126124
onClear,
127125
optionsPending,
128126
optionsFiltered,
129-
focused,
130127
focusedKey,
131128
onFocusedKeyChange,
132-
onFocusedChange,
133129
dropdownShown,
134130
onDropdownShownChange,
135131
totalOptionsCount,
@@ -350,11 +346,9 @@ function SelectInputContainer<OK extends OptionKey, N extends string, O extends
350346
readOnly={readOnly}
351347
uiMode={uiMode}
352348
disabled={disabled}
353-
value={(dropdownShown || focused) ? searchText : valueDisplay}
349+
value={dropdownShown ? searchText : valueDisplay}
354350
onChange={handleSearchInputChange}
355351
onClick={handleSearchInputClick}
356-
onFocus={() => onFocusedChange(true)}
357-
onBlur={() => onFocusedChange(false)}
358352
placeholder={isTruthyString(valueDisplay) ? valueDisplay : placeholder}
359353
autoComplete="off"
360354
onKeyDown={handleKeyDown}

0 commit comments

Comments
 (0)