|
43 | 43 | @blur="handleBlur"
|
44 | 44 | @focus="handleFocus"
|
45 | 45 | @keypress="handleKeyPress"
|
46 |
| - @keydown="handleKeyPress($event, true)" |
| 46 | + @keydown="handleKeyPress($event)" |
47 | 47 | @paste="handlePaste"
|
48 | 48 | />
|
49 | 49 | <div @click="emit('toggle')">
|
|
62 | 62 | /></span>
|
63 | 63 | <button
|
64 | 64 | v-if="clearable && !$slots['clear-icon'] && inputValue && !disabled && !readonly"
|
65 |
| - ref="clearBtnRef" |
66 | 65 | :aria-label="defaultedAriaLabels?.clearInput"
|
67 | 66 | class="dp--clear-btn"
|
68 | 67 | type="button"
|
69 |
| - @blur="clearBtnFocused = false" |
70 | 68 | @keydown="checkKeyDown($event, () => onClear($event), true, onClearKeydown)"
|
71 | 69 | @click.prevent="onClear($event)"
|
72 | 70 | >
|
|
136 | 134 | const parsedDate = ref();
|
137 | 135 | const inputRef = ref<HTMLInputElement | null>(null);
|
138 | 136 | const isFocused = ref(false);
|
139 |
| - const clearBtnFocused = ref(false); |
140 | 137 | const textPasted = ref(false);
|
141 |
| - const clearBtnRef = ref<HTMLElement | null>(null); |
142 | 138 |
|
143 | 139 | const inputClass = computed(
|
144 | 140 | (): DynamicClass => ({
|
|
241 | 237 | }
|
242 | 238 | };
|
243 | 239 |
|
244 |
| - const handleTab = (ev: KeyboardEvent, fromInput?: boolean): void => { |
245 |
| - if (clearBtnRef.value && fromInput && !clearBtnFocused.value) { |
246 |
| - ev.preventDefault(); |
247 |
| - clearBtnFocused.value = true; |
248 |
| - clearBtnRef.value?.focus(); |
249 |
| - } |
250 |
| - if (defaultedTextInput.value.enabled && defaultedTextInput.value.tabSubmit) { |
| 240 | + const handleTab = (ev: KeyboardEvent, noParse?: boolean): void => { |
| 241 | + if (defaultedTextInput.value.enabled && defaultedTextInput.value.tabSubmit && !noParse) { |
251 | 242 | parseInput((ev.target as HTMLInputElement).value);
|
252 | 243 | }
|
253 | 244 |
|
|
299 | 290 | emit('clear');
|
300 | 291 | };
|
301 | 292 |
|
302 |
| - const handleKeyPress = (ev: KeyboardEvent, fromInput?: boolean): void => { |
| 293 | + const handleKeyPress = (ev: KeyboardEvent): void => { |
303 | 294 | if (ev.key === 'Tab') {
|
304 |
| - handleTab(ev, fromInput); |
| 295 | + handleTab(ev); |
305 | 296 | }
|
306 | 297 | if (ev.key === 'Enter') {
|
307 | 298 | handleEnter(ev);
|
|
322 | 313 |
|
323 | 314 | const onClearKeydown = (event: KeyboardEvent) => {
|
324 | 315 | if (event.key === EventKey.tab) {
|
325 |
| - clearBtnFocused.value = false; |
326 |
| - handleTab(event); |
| 316 | + handleTab(event, true); |
327 | 317 | }
|
328 | 318 | };
|
329 | 319 |
|
|
0 commit comments