refactors re-shelve button dropdown to be accessible

still looks janky as heck, but fixes #350
This commit is contained in:
Mouse Reeve 2020-11-16 16:34:26 -08:00
parent 699a661f00
commit 680211cff5
2 changed files with 12 additions and 14 deletions

View file

@ -12,7 +12,7 @@
<ul class="dropdown-content">
{% for shelf in request.user.shelf_set.all %}
{% if shelf.identifier != current.identifier %}
<li>
<li role="menuitem">
<form class="dropdown-item pt-0 pb-0" name="shelve" action="/shelve/" method="post">
{% csrf_token %}
<input type="hidden" name="book" value="{{ book.id }}">

View file

@ -1,9 +1,8 @@
{% load fr_display %}
{% if request.user.is_authenticated %}
{% active_shelf book as active_shelf %}
<div class="field is-grouped">
{% with book.id|uuid as uuid %}
<div class="field is-grouped">
{% if active_shelf.identifier == 'read' %}
<button class="button is-small" disabled>
<span>Read</span> <span class="icon icon-check"></span>
@ -26,20 +25,20 @@
<button class="button is-small" type="submit">Want to read</button>
</form>
{% endif %}
{% endwith %}
<div class="dropdown is-hoverable">
<div class="dropdown">
<div class="dropdown-trigger">
<button class="button is-small" aria-haspopup="true" aria-controls="dropdown-menu-{{ uuid }}">
<label for="shelf-select-dropdown-{{ uuid }}-toggle" role="button" aria-expanded="false" onclick="toggleMenu(this)" tabindex="0" aria-haspopup="true" aria-controls="shelf-select-{{ uuid }}">
<div class="button is-small">
<span class="icon icon-arrow-down"><span class="is-sr-only">More shelves</span></span>
</button>
</div>
{% with book.id|uuid as uuid %}
<div class="dropdown-menu" id="dropdown-menu-{{ uuid }}" role="menu">
</label>
</div>
<input type="checkbox" class="toggle-control" id="shelf-select-dropdown-{{ uuid }}-toggle">
<div class="dropdown-menu toggle-content hidden" id="shelf-select-{{ uuid }}" role="menu">
<ul class="dropdown-content">
{% for shelf in request.user.shelf_set.all %}
<li>
<li role="menuitem">
{% if shelf.identifier == 'to-read' %}
<div class="dropdown-item pt-0 pb-0">
<label class="button is-small" for="start-reading-{{ uuid }}" role="button" tabindex="0">
@ -61,8 +60,7 @@
{% endfor %}
</ul>
</div>
</div>
</div>
{% endwith %}
</div>
</div>
{% endif %}