Skip to content

Commit

Permalink
♻️ Simplify the focus and blur call with modern ES6 feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Balaji Sridharan committed Oct 21, 2024
1 parent d07308d commit 2019c8e
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -454,17 +454,13 @@ export default class DatePicker extends Component<

safeFocus = () => {
setTimeout(() => {
if (this.input && this.input.focus) {
this.input.focus({ preventScroll: true });
}
this.input?.focus?.({ preventScroll: true });
}, 0);
};

safeBlur = () => {
setTimeout(() => {
if (this.input && this.input.blur) {
this.input.blur();
}
this.input?.blur?.();
}, 0);
};

Expand Down

0 comments on commit 2019c8e

Please sign in to comment.