-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong types issue with aria-label and aria-labelledby Props #4511
Comments
Dirty workaround to get primevue to work with recent Ignoring primevue problematic properties and reemit them with valid name // See: https://github.com/primefaces/primevue/issues/4511
export interface Props extends Omit<DropdownProps, 'aria-label' | 'aria-labelledby'> {
/**
* Used to define a string that labels the element.
*/
ariaLabel?: string | undefined
/**
* Establishes relationships between the component and label(s) where its value should be one or more element IDs.
*/
ariaLabelledby?: string | undefined
}
const props = defineProps<Props>() Sadly, vue-compiler needs props types to be statically typed to infer props, so we can't use a generic to automate that |
I'm getting the same issue.
I found this answer online, but it fails in build time. |
Also getting this issue here. This is only when using the InputXProps directly, if you add it into a property of the props type it will work.
|
Thanks Tuğçe |
Describe the bug
I was updating an existing project to recent version vitejs, vue, typescript.
A big upgrade party, where I got almost everything working except one weird last typing issue.
I started to get a some errors caused by two properties
aria-label
&aria-labelledby
in primevue components (most of them):I don't know were the issue comes from exactly yet, but there is definitely some mismatch in these types between
kebab-case
andcamelCase
. I guess typescript or vue got more strict over time and are now able to complain about some primevue issues which were ignored until now.And the place the error is pointing at feels indeed wrong, these two properties should probably be camelcase like everything else in these files. They seem to have been copied from somewhere else and go against the code convention used by every other Props.
These properties seem to have been added in the past few month for accessibility purpose:
https://github.com/primefaces/primevue/pull/3354/files
Example
Screenshot
Reproducer
https://github.com/kefniark/primevue-casing-issue
PrimeVue version
3.35
Vue version
3.x
Language
TypeScript
Build / Runtime
Vite
Browser(s)
No response
Steps to reproduce the behavior
Follow the Readme
Expected behavior
These two properties
aria-label
&aria-labelledby
Should be camelCase (in both the
.vue
and.d.ts
files) and don't need extra quotesThe text was updated successfully, but these errors were encountered: