eslint jsx-a11y label must associated with a control error

问题描述 投票:0回答:1
jsx eslint eslint-config-airbnb tailwind-ui jsx-a11y
1个回答
0
投票

我很确定归结为:

输入需要 also 在标签内以满足更严格的规则形式(例如,airbnb 配置配置)。

eslint-plugin-jsx-a11y #718(评论)

但那时我放弃了——我确实确认如果我把它放在标签里然后它就不会再报错了:

<div className="flex items-center">
    <label
        htmlFor="filter-mobile-color-1"
        className="ml-3 min-w-0 flex-1 text-gray-500"
    >
        <input
            id="filter-mobile-color-1"
            name="color[]"
            value="beige"
            type="checkbox"
            className="h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"
        />
        Beige
    </label>
</div>

我刚刚停止使用这个例子。

© www.soinside.com 2019 - 2024. All rights reserved.