Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 72416

How do I add tabindex="0" to every in Arbre

$
0
0

I'm updating some old code to be ADA compliant and need to give each <li> in the nav tabindex="0" so they are all accessible via keyboard.

This is the code that generates the navigation <li>s. It wasn't written by me and I only knew what Arbre was because a senior dev pointed it out but neither of us are sure how to add the tabindex.

def nav_item_column_list(nav_item, row_number, column_number)
sub_item = nav_item.children.where(column_number: column_number).all[row_number]

if sub_item.present?
  Arbre::Context.new({:helper => self}) do
    ul do
      li do
        a sub_item.title, href: sub_item.url
        if sub_item.children.count > 0
          ul do
            sub_item.children.each do |child|
              li do
                a child.title, href: child.url
              end
            end
          end
        end
      end
    end
  end
end

end


Viewing all articles
Browse latest Browse all 72416

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>