Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(DateInput): Clear DateInput focus when click Done button #6312

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/vkui/src/hooks/useDateInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
const { window } = useDOM();

const removeFocusFromField = React.useCallback(() => {
if (open) {
if (focusedElement !== null) {

Check warning on line 42 in packages/vkui/src/hooks/useDateInput.ts

View check run for this annotation

Codecov / codecov/patch

packages/vkui/src/hooks/useDateInput.ts#L42

Added line #L42 was not covered by tests
setFocusedElement(null);
closeCalendar();
window!.getSelection()?.removeAllRanges();
setInternalValue(getInternalValue(value));
}
}, [closeCalendar, getInternalValue, open, value, window]);
}, [focusedElement, closeCalendar, getInternalValue, value, window]);

const handleClickOutside = React.useCallback(
(e: MouseEvent) => {
Expand Down
Loading