Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf9c38e3

Browse files
fix(dropdown): corrige fluxo de encerramento e restaura foco
Evita chamadas indevidas de close no popup e garante que o focoretorne ao elemento do dropdown após o fechamento. Torna o método`hideDropdown` acessível a subclasses e adiciona listener defechamento `(p-close)="hideDropdown()"` no template para manter oestado consistente.Fixes DTHFUI-11656
1 parentdf3ba1d commitf9c38e3

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

‎projects/ui/src/lib/components/po-dropdown/po-dropdown.component.html‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@
2626
[p-custom-positions]="['bottom-left', 'top-left']"
2727
[p-size]="size"
2828
[p-target]="dropdownRef"
29+
(p-close)="hideDropdown()"
2930
>
3031
</po-popup>

‎projects/ui/src/lib/components/po-dropdown/po-dropdown.component.spec.ts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,13 @@ describe('PoDropdownComponent: ', () => {
129129
icon:undefined,
130130
removeListeners:jasmine.createSpy('removeListeners'),
131131
popupRef:{
132-
close:jasmine.createSpy('close')
132+
close:jasmine.createSpy('close'),
133+
showPopup:true
134+
},
135+
dropdownRef:{
136+
nativeElement:{
137+
focus:jasmine.createSpy('focus')
138+
}
133139
},
134140
open:undefined,
135141
changeDetector:{
@@ -142,6 +148,7 @@ describe('PoDropdownComponent: ', () => {
142148
expect(fakeThis.icon).toBe('ICON_ARROW_DOWN');
143149
expect(fakeThis.removeListeners).toHaveBeenCalled();
144150
expect(fakeThis.popupRef.close).toHaveBeenCalled();
151+
expect(fakeThis.dropdownRef.nativeElement.focus).toHaveBeenCalled();
145152
expect(fakeThis.open).toBe(false);
146153
expect(fakeThis.changeDetector.detectChanges).toHaveBeenCalled();
147154
});

‎projects/ui/src/lib/components/po-dropdown/po-dropdown.component.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,13 @@ export class PoDropdownComponent extends PoDropdownBaseComponent {
6060
returnthis.dropdownRef&&this.dropdownRef.nativeElement.contains(event.target);
6161
}
6262

63-
privatehideDropdown(){
63+
protectedhideDropdown(){
6464
this.icon='ICON_ARROW_DOWN';
6565
this.removeListeners();
66-
this.popupRef.close();
66+
if(this.popupRef.showPopup){
67+
this.popupRef.close();
68+
}
69+
this.dropdownRef.nativeElement.focus();
6770
this.open=false;
6871
this.changeDetector.detectChanges();
6972
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp