Skip to content

Commit

Permalink
fix(datepicker): has focus on click input
Browse files Browse the repository at this point in the history
  • Loading branch information
aesteves60 committed Oct 31, 2023
1 parent 6c06d99 commit b9b74ce
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class OdsDatepickerController {
this.component = component;
}

onFocus() {
onFocus(): void {
if (!this.component.disabled) {
this.component.hasFocus = true;
this.component.emitFocus();
Expand All @@ -29,16 +29,19 @@ class OdsDatepickerController {
this.component.datepickerInstanceAccessor?.setDate(newValue);
this.component.emitDatepickerValueChange(newValue, oldValue ? oldValue : null);
}
this.component.el.focus();
this.component.el.blur();
this.component.hasFocus = false;
}
}

onBlur() {
onBlur(): void {
this.component.hasFocus = false;
this.component.emitBlur();
}

onClick(): void {
this.component.hasFocus = true;
}

private getMidnightDate(date: Date): Date {
return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@ export class OsdsDatepicker implements OdsDatepickerAttribute, OdsDatepickerEven
this.controller.onFocus();
}

componentDidLoad() {
onClick(): void {
this.controller.onClick();
}

componentDidLoad(): void {
this.initializeDatepicker();
}

Expand Down Expand Up @@ -302,6 +306,7 @@ export class OsdsDatepicker implements OdsDatepickerAttribute, OdsDatepickerEven
onFocus: () => this.onFocus(),
}}>
<osds-input
onClick={ () => this.onClick() }
clearable={clearable}
color={color}
disabled={disabled}
Expand Down

0 comments on commit b9b74ce

Please sign in to comment.
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy