Skip to content

Commit

Permalink
Clean up advanced search toggle.
Browse files Browse the repository at this point in the history
This also introduces the "Search options" string. When the button uses
aria-labelledby to be read by screen readers, Voiceover will clobber
status changes trying to read out the aria-labelledby attribute.
"Search Options, expanded, button" disappears under "Search Options".
By using only aria-label, Voiceover will actually read the button status
change in a reasonable manner.
  • Loading branch information
kimisgold committed Nov 8, 2024
1 parent 8bff1b1 commit 56c7f08
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 18 deletions.
8 changes: 4 additions & 4 deletions admin/themes/default/css/sass/components/_search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,6 @@
box-sizing: border-box;
width: 100%;

&.open {
display: block;
}

input[type=radio] { margin: 0 9px 0 0; }
input[type=checkbox] { margin-right: 5px; }

Expand All @@ -115,6 +111,10 @@
}
}

.show-advanced.open + #advanced-form {
display: block;
}

#advanced-search-form {
.advanced-search-terms {
margin-bottom: $spacing-m;
Expand Down
5 changes: 3 additions & 2 deletions admin/themes/default/css/style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions admin/themes/default/css/style.css.map

Large diffs are not rendered by default.

10 changes: 2 additions & 8 deletions admin/themes/default/javascripts/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,9 @@ if (!Omeka) {
};

Omeka.showAdvancedForm = function () {
var advanced_form = $('#advanced-form');
advanced_form.addClass('closed');
$('#search-container').addClass('with-advanced');

$('.show-advanced').click(function(e) {
e.preventDefault();
$('#search-form').on('click', '.show-advanced', function() {
var advanced_toggle = $(this);
advanced_toggle.toggleClass('open').toggleClass('closed');
advanced_form.toggleClass('open').toggleClass('closed');
advanced_toggle.toggleClass('open');
if (advanced_toggle.hasClass('open')) {
advanced_toggle.attr('aria-expanded', true);
} else {
Expand Down
4 changes: 2 additions & 2 deletions application/views/scripts/search/search-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
));
?>
<?php if ($options['show_advanced']): ?>
<button id="advanced-search" type="button" aria-expanded="false" aria-controls="advanced-form" class="show-advanced button closed" aria-label="<?php echo __('Options'); ?>" title="<?php echo __('Options'); ?>" aria-labelledby="search-form advanced-search">
<button id="advanced-search" type="button" aria-expanded="false" class="show-advanced button" title="<?php echo __('Search options'); ?>" aria-label="<?php echo __('Search options') ?>">
<span class="icon" aria-hidden="true"></span>
</button>
<div id="advanced-form" class="closed" aria-labelledby="search-form advanced-search" aria-role="region">
<div id="advanced-form">
<fieldset id="query-types">
<legend><?php echo __('Search using this query type:'); ?></legend>
<?php echo $this->formRadio('query_type', $filters['query_type'], null, $query_types); ?>
Expand Down

0 comments on commit 56c7f08

Please sign in to comment.