Class: ERBLint::Linters::GitHub::Accessibility::AvoidBothDisabledAndAriaDisabled
- Inherits:
-
Linter
- Object
- Linter
- ERBLint::Linters::GitHub::Accessibility::AvoidBothDisabledAndAriaDisabled
- Includes:
- CustomHelpers, LinterRegistry
- Defined in:
- lib/erblint-github/linters/github/accessibility/avoid_both_disabled_and_aria_disabled.rb
Constant Summary collapse
- ELEMENTS_WITH_NATIVE_DISABLED_ATTRIBUTE_SUPPORT =
%w[button fieldset input optgroup option select textarea].freeze
- MESSAGE =
"[aria-disabled] may be used in place of native HTML [disabled] to allow tab-focus on an otherwise ignored element. Setting both attributes is contradictory."
Constants included from CustomHelpers
CustomHelpers::INTERACTIVE_ELEMENTS
Instance Method Summary collapse
Methods included from CustomHelpers
#basic_conditional_code_check, #counter_correct?, #focusable?, #generate_offense, #generate_offense_from_source_range, #possible_attribute_values, #simple_class_name, #tags
Instance Method Details
#run(processed_source) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/erblint-github/linters/github/accessibility/avoid_both_disabled_and_aria_disabled.rb', line 16 def run(processed_source) (processed_source).each do |tag| next if tag.closing? next unless ELEMENTS_WITH_NATIVE_DISABLED_ATTRIBUTE_SUPPORT.include?(tag.name) next unless tag.attributes["disabled"] && tag.attributes["aria-disabled"] generate_offense(self.class, processed_source, tag) end end |