diff --git a/api_formatter/static/css/styles.css b/api_formatter/static/css/styles.css index f48b53f..a82af25 100644 --- a/api_formatter/static/css/styles.css +++ b/api_formatter/static/css/styles.css @@ -1,7 +1,3 @@ -/* html { - height:100% -} */ - h2 { margin-bottom: 0; margin-top: 0; @@ -11,10 +7,6 @@ h3 { margin-top: 10px; } -.dropdown__list--mobile { - z-index: 999; -} - .main { grid-column: 2 / span 10; } @@ -46,11 +38,3 @@ pre { min-height: 0; padding: 10px; } - -.card:hover, .card:focus { - box-shadow: 0 0 0 1px #bcbab3,0 0 4px 0 #c8c6c1; -} - -.font-weight-bold { - font-weight: bold; -} \ No newline at end of file diff --git a/api_formatter/static/js/custom.js b/api_formatter/static/js/custom.js index 7ad0754..ba76175 100644 --- a/api_formatter/static/js/custom.js +++ b/api_formatter/static/js/custom.js @@ -1,14 +1,22 @@ // Handles clicks on the mobile nav toggle button + document.getElementById('nav-toggle').addEventListener('click', function() { - const expandedCurrent = this.getAttribute('aria-expanded') - + const expandedCurrent = this.getAttribute('aria-expanded'); + // Sets classes and attributes on the nav-toggle - this.classList.toggle('active') - this.classList.toggle('closed') - this.setAttribute('aria-expanded', expandedCurrent === 'true' ? 'false' : 'true') + this.classList.toggle('active'); + this.classList.toggle('closed'); + this.setAttribute('aria-expanded', expandedCurrent === 'true' ? 'false' : 'true'); // Sets classes and attributes on the nav-toggle-menu - menu = document.getElementById('nav-toggle-menu') - menu.classList.toggle('active') - menu.classList.toggle('closed') -}) \ No newline at end of file + const menu = document.getElementById('nav-toggle-menu'); + menu.classList.toggle('active'); + menu.classList.toggle('closed'); + + // Toggles tabindex values for each link + const links = menu.querySelectorAll('.dropdown__btn--mobile'); + const isActive = menu.classList.contains('active'); + links.forEach(link => { + link.tabIndex = isActive ? 0 : -1; + }); + }); \ No newline at end of file diff --git a/api_formatter/templates/rest_framework/api.html b/api_formatter/templates/rest_framework/api.html index e4bf2a1..2730e10 100644 --- a/api_formatter/templates/rest_framework/api.html +++ b/api_formatter/templates/rest_framework/api.html @@ -7,7 +7,7 @@ {% block style %} - + {% endblock %} @@ -55,22 +55,22 @@