Skip to content

Instantly share code, notes, and snippets.

@bergatron
Created October 3, 2018 20:57
Show Gist options
  • Save bergatron/71f0eac50c3a8b11d3d8715819c77c58 to your computer and use it in GitHub Desktop.
Save bergatron/71f0eac50c3a8b11d3d8715819c77c58 to your computer and use it in GitHub Desktop.
Content Filter Controller
# Accessibility
renderAriaStatus: ->
@ariaStatusElement?.textContent = @setAriaStatus()
setAriaStatus: ->
if @element.query
if @element.matchCount == 0
"No matches!"
else
"#{@getAriaStatusText()} - #{@getAriaMatchCount()}"
else
"#{@getAriaStatusText()} selected, #{@ariaDescriptionElement?.textContent}"
getAriaStatusText: ->
@selectedElement?.querySelector(selectors.ariaText).textContent.trim()
getAriaMatchCount: ->
"Match #{@element.selectedIndex + 1} of #{@element.matchCount}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment