Skip to content

Commit

Permalink
Fix a11y tests for duplicate IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
okkays committed Nov 22, 2024
1 parent af671d0 commit 1da6afa
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions _plugins/details.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
module Jekyll
class DetailsTag < Liquid::Block

@@ids = Hash.new(0)

def initialize(tag_name, block_options, liquid_options)
super
@expand = ''
Expand All @@ -9,7 +12,10 @@ def initialize(tag_name, block_options, liquid_options)
@expand = 'expand'
end
@title = @options.join(" ")

@id = @options.join("-").downcase
@@ids[@id] += 1
@id += "-#{@@ids[@id]}" if @@ids[@id] > 1
end

def render(context)
Expand Down

0 comments on commit 1da6afa

Please sign in to comment.