TypeScript-DOM-lib-generator icon indicating copy to clipboard operation
TypeScript-DOM-lib-generator copied to clipboard

Added strict typings for `ARIAMixin` with literals

Open DeepDoge opened this issue 1 year ago • 5 comments

Added stricter typings for ARIAMixin with a fallback to also allow any other string. Also used ${bigint} and ${number} to type, integer and number only properties.

I wasn't sure if I should create a new enum type for each ARIA property, so I inlined them in the overrideType.

Fixes the issue: https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/1835

DeepDoge avatar Nov 03 '24 17:11 DeepDoge

Thanks for the PR!

This section of the codebase is owned by @saschanaz - if they write a comment saying "LGTM" then it will be merged.

github-actions[bot] avatar Nov 03 '24 17:11 github-actions[bot]

@microsoft-github-policy-service agree

DeepDoge avatar Nov 03 '24 17:11 DeepDoge

Removed commented items. Removed string & {} from types, and empty string from number and integer types. Updated roles based on W3C instead of MDN, filtered out deprecated and abstract ones. Added type for ariaInvalid. MDN was missing documention for ariaInvalid, but has one for aria-invalid attribute. So I missed it as well since I was looking into Element API on MDN. ariaInvalid has full browser support already.

DeepDoge avatar Nov 04 '24 13:11 DeepDoge

@saschanaz Should I include roles listed at https://www.w3.org/TR/dpub-aria-1.1/#role_definitions? Svelte includes them in [role] attribute.

DeepDoge avatar Nov 04 '24 14:11 DeepDoge

Stumbled across this PR - seems like a great addition! @saschanaz Anything you need before this can be merged?

@DeepDoge I wouldn't include the dpub roles as they are only a proposed recommendation and are not fully baked.

myasonik avatar May 22 '25 04:05 myasonik