Skip to content

Commit

Permalink
Fixed #3289 - Panel: toggleButtonProps prop defect
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Nov 17, 2022
1 parent 6665952 commit 259b908
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/components/panel/Panel.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { VNode } from 'vue';
import { ButtonHTMLAttributes, VNode } from 'vue';
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';

export interface PanelToggleEvent {
Expand Down Expand Up @@ -28,7 +28,7 @@ export interface PanelProps {
/**
* Uses to pass the custom value to read for the button inside the component.
*/
toggleButtonProps?: string | undefined;
toggleButtonProps?: ButtonHTMLAttributes | undefined;
}

export interface PanelSlots {
Expand Down
6 changes: 5 additions & 1 deletion src/components/panel/Panel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
type="button"
role="button"
class="p-panel-header-icon p-panel-toggler p-link"
:aria-label="toggleButtonProps || header"
:aria-label="buttonAriaLabel"
:aria-controls="ariaId + '_content'"
:aria-expanded="!d_collapsed"
@click="toggle"
@keydown="onKeyDown"
v-bind="toggleButtonProps"
>
<span :class="{ 'pi pi-minus': !d_collapsed, 'pi pi-plus': d_collapsed }"></span>
</button>
Expand Down Expand Up @@ -81,6 +82,9 @@ export default {
},
containerClass() {
return ['p-panel p-component', { 'p-panel-toggleable': this.toggleable }];
},
buttonAriaLabel() {
return this.toggleButtonProps && this.toggleButtonProps['aria-label'] ? this.toggleButtonProps['aria-label'] : this.header;
}
},
directives: {
Expand Down
2 changes: 1 addition & 1 deletion src/views/panel/PanelDoc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ import Panel from 'primevue/panel';
</tr>
<tr>
<td>toggleButtonProps</td>
<td>string</td>
<td>object</td>
<td>null</td>
<td>Uses to pass the custom value to read for the button inside the component.</td>
</tr>
Expand Down

0 comments on commit 259b908

Please sign in to comment.