Describe the bug
When using the Dialog component with a custom header slot and without providing the header prop, the component still generates and assigns an aria-labelledby attribute with an internal ID. However, this ID is not applied to any actual DOM element in the custom header. As a result, the attribute references a non-existent element, which breaks accessibility.
Pull Request Link
#8549
Reproducer
https://primevue.org/dialog/#headless
Environment
Nuxt.js (4.2.2)
Vue version
3.5.26
PrimeVue version
4.5.4
Node version
No response
Browser(s)
No response
Steps to reproduce the behavior
- Go to https://primevue.org/dialog/#headless
- Open dialog
- On the child element of root p-dialog-mask there is div "p-dialog p-component !border-0 !bg-transparent" with assigned aria-labelledby attribute, but there is no possibility to attach this id to customer header element, which leading to breaking accessibility and aria-labelledby attribute references to non-exist header's id.
Expected behavior
Maybe pass into the slot parameters the generated id like this
<PrimeDialog
v-model:visible="visible"
:closable="false"
:draggable="false"
class="car-edit-dialog tablet:min-w-167.5 mx-6"
data-pw="car-edit-dialog"
modal
>
<template #header={ headerId }>
<div class="flex items-center justify-between w-full relative">
<h2 :id="headerId" class="ods-typography-subtitle">{{ $t('car-edit-dialog.title') }}</h2>
</div>
</template>
Describe the bug
When using the Dialog component with a custom header slot and without providing the header prop, the component still generates and assigns an aria-labelledby attribute with an internal ID. However, this ID is not applied to any actual DOM element in the custom header. As a result, the attribute references a non-existent element, which breaks accessibility.
Pull Request Link
#8549
Reproducer
https://primevue.org/dialog/#headless
Environment
Nuxt.js (4.2.2)
Vue version
3.5.26
PrimeVue version
4.5.4
Node version
No response
Browser(s)
No response
Steps to reproduce the behavior
Expected behavior
Maybe pass into the slot parameters the generated id like this