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

no-incompatible-type-binding on HTML role Attribute too restrictive #89

Closed
ghost opened this issue Mar 16, 2020 · 3 comments · Fixed by #112
Closed

no-incompatible-type-binding on HTML role Attribute too restrictive #89

ghost opened this issue Mar 16, 2020 · 3 comments · Fixed by #112

Comments

@ghost
Copy link

ghost commented Mar 16, 2020

If we specify multiple roles on an html element like

<div role="button listitem"></div>

lit-analyzer surfaces an error because it tries to match the role attribute to exactly ONE role. However, the spec allows for a list of roles. I tried to dig into the code a little bit and it seems lit-analyzer gets part of this logic from vscode-html-languageservice But perhaps is being too strict or using it incorrectly.

@runem
Copy link
Owner

runem commented Jul 8, 2020

Thanks for reporting this bug!

In order to fix this I have to come op with a solution where the "whitespace-separated-string-literal-union"-type can be type checked using both a custom type and custom type checking logic.

This will have to include these 2/3 attributes (there might be more):

The type checker will have to split the value by whitespace, check that there are no duplicates and make sure that all values in the list are assignable to the string literal union.

runem added a commit that referenced this issue Jul 8, 2020
@runem
Copy link
Owner

runem commented Jul 8, 2020

I just finished adding support for the role and controlslist attributes. I will close this issue when the fix has been released.

list-type-checking

@scola84
Copy link

scola84 commented Aug 26, 2020

Would it be possible to apply this to user-defined attributes too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants