diff --git a/bookwyrm/static/js/shared.js b/bookwyrm/static/js/shared.js index eb4ab677..5be6ed63 100644 --- a/bookwyrm/static/js/shared.js +++ b/bookwyrm/static/js/shared.js @@ -31,22 +31,23 @@ function rate_stars(e) { return true; } -function tabChange(e) { +function tabChange(e, nested) { var target = e.target.closest('li') var identifier = target.getAttribute('data-id'); - var parent_element = target.parentElement.closest('li').parentElement; - var tabs = parent_element.getElementsByTagName('label'); - for (i = 0; i < tabs.length; i++) { - var tab = tabs[i].parentElement; - if (tab.getAttribute('data-id') == identifier) { - tab.className += ' is-active'; - } else { - tab.className = tab.className.replace('is-active', ''); - } + if (nested) { + var parent_element = target.parentElement.closest('li').parentElement; + } else { + var parent_element = target.parentElement; } - var el = document.getElementById(identifier); + parent_element.querySelectorAll('[aria-selected="true"]') + .forEach(t => t.setAttribute("aria-selected", false)); + target.querySelector('[role="tab"]').setAttribute("aria-selected", true); + + parent_element.querySelectorAll('li') + .forEach(t => t.className=''); + target.className = 'is-active'; } function ajaxPost(form) { diff --git a/bookwyrm/templates/feed.html b/bookwyrm/templates/feed.html index bc533db4..46e7bc2a 100644 --- a/bookwyrm/templates/feed.html +++ b/bookwyrm/templates/feed.html @@ -21,7 +21,13 @@ diff --git a/bookwyrm/templates/snippets/create_status.html b/bookwyrm/templates/snippets/create_status.html index f8c5b3cf..e36b1b19 100644 --- a/bookwyrm/templates/snippets/create_status.html +++ b/bookwyrm/templates/snippets/create_status.html @@ -2,15 +2,27 @@ {% load fr_display %}
-
@@ -22,7 +34,7 @@
- {% include 'snippets/create_status_form.html' with type="comment" placeholder="Some thougts on '"|add:book.title|add:"'" %} + {% include 'snippets/create_status_form.html' with type="comment" placeholder="Some thoughts on '"|add:book.title|add:"'" %}
diff --git a/bookwyrm/templates/snippets/shelve_button.html b/bookwyrm/templates/snippets/shelve_button.html index a2938ad5..ff0c660f 100644 --- a/bookwyrm/templates/snippets/shelve_button.html +++ b/bookwyrm/templates/snippets/shelve_button.html @@ -38,14 +38,6 @@