diff --git a/options.html b/options.html
index 6dbb2173..63dbecf1 100644
--- a/options.html
+++ b/options.html
@@ -125,12 +125,16 @@
diff --git a/options/options.js b/options/options.js
index b563c34b..ca50688b 100644
--- a/options/options.js
+++ b/options/options.js
@@ -8,15 +8,14 @@ setTimeout(splitLongTooltips);
if (!FIREFOX && !OPERA) {
const block = $('#advanced');
- const toggleAdvanced = event => {
- if (block.classList.contains('collapsed') || event.target.closest('h1')) {
- block.classList.toggle('collapsed');
- }
+ $('h1', block).onclick = event => {
+ event.preventDefault();
+ block.classList.toggle('collapsed');
+ const isCollapsed = block.classList.contains('collapsed');
+ const visibleToggle = $(isCollapsed ? '.is-collapsed' : '.is-expanded', block);
+ visibleToggle.focus();
};
block.classList.add('collapsible', 'collapsed');
- block.onclick = toggleAdvanced;
- block.onkeydown = event => event.which === 13 && toggleAdvanced(event);
- $('h1', block).tabIndex = 0;
}
// actions