Skip to content

Exclude color-contrast for disabled fields using disabled attribute. #168

Description

@sandeep-chennupati

Hi, I am trying to disable/exclude color-contrast only on disabled fields in cypress-axe. Is it possible?

const off = [
    'html-has-lang',
    'landmark-one-main',
    'page-has-heading-one',
    'region',
];

// config: https://github.com/component-driven/cypress-axe#cyconfigureaxe
// context, options: https://github.com/component-driven/cypress-axe#cychecka11y
export default (
    node = null,
    config = {rules: []},
    {context = null, options = null} = {
        context: null,
        options: null,
    },
    delay = 0
) => {
    init({
        ...config,
        rules: off
            .map(id => ({
                id,
                enabled: false,
            }))
            .concat(config.rules),
    });

    // add a .wait to make sure a render cycle is run before checkA11y so that
    // the styles for the element(s) can be applied before a11y tests are executed
    return mount(node).wait(delay).checkA11y(context, options, terminalLog);
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions