Skip to content

Commit

Permalink
MultiSelect | Fix header checkbox focus
Browse files Browse the repository at this point in the history
  • Loading branch information
cetincakiroglu committed Oct 24, 2023
1 parent 1731e86 commit c842b8d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/app/components/multiselect/multiselect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ export class MultiSelectItem {
>
<div class="p-hidden-accessible" [attr.data-p-hidden-accessible]="true">
<input
#headerCheckbox
type="checkbox"
[readonly]="readonly"
[attr.checked]="allSelected()"
Expand Down Expand Up @@ -839,6 +840,8 @@ export class MultiSelect implements OnInit, AfterViewInit, AfterContentInit, Aft

@ViewChild('firstHiddenFocusableEl') firstHiddenFocusableElementOnOverlay: Nullable<ElementRef>;

@ViewChild('headerCheckbox') headerCheckboxViewChild: Nullable<ElementRef>;

@ContentChild(Footer) footerFacet: any;

@ContentChild(Header) headerFacet: any;
Expand Down Expand Up @@ -1719,6 +1722,8 @@ export class MultiSelect implements OnInit, AfterViewInit, AfterContentInit, Aft
return;
}

DomHandler.focus(this.headerCheckboxViewChild.nativeElement);

const value = this.allSelected()
? []
: this.visibleOptions()
Expand Down

0 comments on commit c842b8d

Please sign in to comment.