Skip to content

valueRegex for forbid-dom-props rule #3876

Open
@makxca

Description

I want to be able to prohibit the usage of certain values of some dom attributes.

In my case I do not want the other developers in my project to use the listbox aria-role because of its accessibility issues. They should use lists of buttons instead.

This should be invalid

<div role="listbox">

But I do not want to completely forbid the usage of the role attribute, so something like this should be valid

<div role="list">

So I want to be able to configure a rule like the following:

{
    "forbid-dom-props": {
        "forbid": [{
            "propName": "role",
            "valueRegex": "^listbox$",
            "message": "Please do not use listbox. You can use list of buttons instead"
        }]
    }
}

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