Skip to content
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

DetailsHTMLAttributes should have optional name property in jsx #11821

Closed
comfuture opened this issue Sep 5, 2024 · 1 comment · Fixed by #11823
Closed

DetailsHTMLAttributes should have optional name property in jsx #11821

comfuture opened this issue Sep 5, 2024 · 1 comment · Fixed by #11823
Labels
🐞 bug Something isn't working scope: types

Comments

@comfuture
Copy link

Vue version

latest

Link to minimal reproduction

https://github.com/user-attachments/assets/a274be7b-aeff-42b0-ae9a-03fabf1fbb33

Steps to reproduce

  1. Create a Vue component with TSX.
  2. Add a <details> element and assign a [name] attribute (e.g., <details name="example">).
  3. Observe that the [name] attribute is flagged as an error by the language server, despite being valid in HTML5.

What is expected?

The [name] attribute should be recognized as valid for the <details> element, and no error should be flagged.

What is actually happening?

image

When using the <details> element in a Vue component written in TSX, the [name] attribute is valid according to HTML5 specs. However, due to the defined interface, the language server incorrectly flags this as an error and displays a red underline.

in https://github.com/vuejs/core/blob/main/packages/runtime-dom/src/jsx.ts#L407-L410

export interface DetailsHTMLAttributes extends HTMLAttributes {
  open?: Booleanish
  onToggle?: (payload: ToggleEvent) => void
}

According to the MDN Web Docs, the [name] attribute is explicitly valid for the <details> element in HTML5. It allows for multiple named disclosure boxes to interact within a form, making this a crucial feature that should not be incorrectly flagged.

System Info

No response

Any additional comments?

No response

@edison1105 edison1105 added 🐞 bug Something isn't working scope: types labels Sep 5, 2024
@edison1105
Copy link
Member

PR welcome!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐞 bug Something isn't working scope: types
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants