Skip to content

Commit fc8b715

Browse files
committed
per @janiceilene: make the button outlined for the default and solid once pressed to help differentiate the two modes
1 parent 0dde2ae commit fc8b715

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

includes/toggle-images.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<button type="button" class="btn btn-outline ml-3 toggle-images tooltipped tooltipped-n" id="js-toggle-images" aria-selected="true" aria-label="Toggle images">
1+
<button type="button" class="btn btn-outline ml-3 toggle-images" id="js-toggle-images" aria-selected="false" aria-label="Toggle images">
22
<span id="js-hide-text">{% data ui.toggle_images.hide %}</span>
33
<span id="js-show-text">{% data ui.toggle_images.show %}</span>
44
</button>

javascripts/toggle-images.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,14 @@ export default function () {
1919
// The button should say "Hide" by default, so we suppress the "Show" text here.
2020
showText.style.display = 'none'
2121

22+
// The selection state is set to false by default in the button HTML.
23+
let selectionState = toggleImagesBtn.getAttribute('aria-selected') !== 'false'
24+
2225
toggleImagesBtn.addEventListener('click', (e) => {
26+
// On click, toggle the selection state.
27+
selectionState = !selectionState
28+
toggleImagesBtn.setAttribute('aria-selected', selectionState)
29+
2330
// Check first image to see if images are currently hidden; if so, and there is a click to show them...
2431
if (images[0].style.display === 'none') {
2532
// Button should say "Hide"

0 commit comments

Comments
 (0)