Skip to content

ARIA Mixin Properties should be *specific* #1184

@chrisdholt

Description

@chrisdholt

Copying over from microsoft/TypeScript#46456 as I see that these are generated files.


Bug Report

In TypeScript v4.4.0 the ARIAMixin was introduced, which enumerates all properties of the ARIAMixin as string. The FAST team (and subsequently anyone leveraging our Foundation components) is currently blocked from upgrading beyond [email protected] due to these types. The feedback from #45047 calls out the issue that these should be nullable, but we're hitting a somewhat different issue as well. Prior to the introduction of these types, we enumerated these ourselves due to specific requirements around our custom elements which delegate focus. With the introduction of ARIAMixin and the broad definition of strings in 4.4.0 we're hitting type definitions.

While each of these properties are a DOMString, many are specific strings. I don't have a direct link to each in the spec on hand, but I'll link to MDN's enumeration of these (ariaAtomic, ariaAutocomplete, ariaLive, ariaHidden, ariaHasPopup as a few examples). While many of the properties on the Mixin are strings not all are - from a standards and accuracy perspective, I think the typings should be updated to represent specific strings where applicable.

I would be more than happy to contribute a fix for this if you like.

🔎 Search Terms

ARIAMixin - As noted above, #45047 addresses the nullable nature of these, but there are no relevant issues regarding the specific typed DOMString's.

🕗 Version & Regression Information

This changed and is present in all versions greater than 4.3.5 (beginning 4.4.0).

💻 Code

const myElement = document.createElement('div');\

myElement.ariaAtomic = "foo" // not allowed, currently allowed

myElement.ariaAtomic = "true" // ok

myElement.ariaAtomic = "false" // ok

myElement.ariaAtomic = undefined; // ok

🙁 Actual behavior

Any string is valid. Anyone enumerating typed DOMStrings for these will get type errors due to one being essentially a type which !== generic string.

🙂 Expected behavior

The types map to the specification, where properties with specific DOMString values allowed are enumerated and nullable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions