Class: ERBLint::Linters::GitHub::Accessibility::NoPositiveTabIndex
- Inherits:
-
Linter
- Object
- Linter
- ERBLint::Linters::GitHub::Accessibility::NoPositiveTabIndex
- Includes:
- CustomHelpers, LinterRegistry
- Defined in:
- lib/erblint-github/linters/github/accessibility/no_positive_tab_index.rb
Constant Summary collapse
- MESSAGE =
"Do not use positive tabindex as it is error prone and can severely disrupt navigation experience for keyboard users"
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
15 16 17 18 19 20 21 22 |
# File 'lib/erblint-github/linters/github/accessibility/no_positive_tab_index.rb', line 15 def run(processed_source) (processed_source).each do |tag| next if tag.closing? next unless tag.attributes["tabindex"]&.value.to_i.positive? generate_offense(self.class, processed_source, tag) end end |