From 2f16f84544e705ce794c61ecb969bfd6cdebad95 Mon Sep 17 00:00:00 2001 From: Matt Muller Date: Mon, 17 Jul 2023 14:37:09 -0400 Subject: [PATCH] Address feedback from AWS accessibility --- templates/default/fulldoc/html/css/style.css | 11 ++++++++++- templates/default/fulldoc/html/js/full_list.js | 9 +++++---- templates/default/fulldoc/html/setup.rb | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/templates/default/fulldoc/html/css/style.css b/templates/default/fulldoc/html/css/style.css index 8fdda9701..2e085ecf7 100644 --- a/templates/default/fulldoc/html/css/style.css +++ b/templates/default/fulldoc/html/css/style.css @@ -85,7 +85,6 @@ body { @media (max-width: 320px) { body { height: 100%; overflow: hidden; overflow-wrap: break-word; } #main { height: 100%; overflow: auto; } - #search { display: none; } } #main img { max-width: 100%; } @@ -389,6 +388,16 @@ ul.fullTree li:last-child { padding-bottom: 0; } text-align: center; } +.visually-hidden { + position: absolute; + top: auto; + overflow: hidden; + clip: rect(1px, 1px, 1px, 1px); + width: 1px; + height: 1px; + white-space: nowrap; +} + #menu { font-size: 1.3em; color: #bbb; } #menu .title, #menu a { font-size: 0.7em; } #menu .title a { font-size: 1em; } diff --git a/templates/default/fulldoc/html/js/full_list.js b/templates/default/fulldoc/html/js/full_list.js index 6d8ebdd2f..3a4e9c944 100644 --- a/templates/default/fulldoc/html/js/full_list.js +++ b/templates/default/fulldoc/html/js/full_list.js @@ -108,7 +108,7 @@ function enableSearch() { } }); - $('#full_list').after(""); + $('#full_list').after("
"); } function ignoredKeyPress(event) { @@ -136,7 +136,7 @@ function clearSearch() { function performSearch(searchString) { clearSearchTimeout(); $('#full_list, #content').addClass('insearch'); - $('#noresults').text('').hide(); + $('#noresults').text('').addClass('visually-hidden'); partialSearch(searchString, 0); } @@ -173,11 +173,12 @@ function searchDone() { highlight(); var found = $('#full_list li:visible').size(); if (found === 0) { - $('#noresults').text('No results were found.').hide().fadeIn(); + $('#noresults').text('No results were found.'); } else { // This is read out to screen readers - $('#noresults').text('There are ' + found + ' results.').hide().fadeIn(); + $('#noresults').text('There are ' + found + ' results.'); } + $('#noresults').removeClass('visually-hidden'); $('#content').removeClass('insearch'); } diff --git a/templates/default/fulldoc/html/setup.rb b/templates/default/fulldoc/html/setup.rb index edf9dd382..923bc31fb 100644 --- a/templates/default/fulldoc/html/setup.rb +++ b/templates/default/fulldoc/html/setup.rb @@ -232,7 +232,7 @@ def class_list(root = Registry.root, tree = TreeContext.new) out << "
  • " out << "
    " accessible_props = "aria-label='#{name} child nodes' aria-expanded='false' aria-controls='object_#{child.path}'" - out << " " if has_children + out << " " if has_children out << linkify(child, name) out << " < #{child.superclass.name}" if child.is_a?(CodeObjects::ClassObject) && child.superclass out << ""