Index: options.html =================================================================== --- a/options.html +++ b/options.html @@ -214,40 +214,6 @@
+ + Index: options.js =================================================================== --- a/options.js +++ b/options.js @@ -1114,7 +1114,28 @@ openDialog("predefined"); break; case "focusSection": - document.body.setAttribute("data-tab", message.args[0]); + var tabs = document.querySelectorAll("nav [id^=tab-]"); + for (var i = 0; i < tabs.length; i++) + { + var tab = tabs[i]; + var section = document.querySelector( + "#content-" + tab.id.substr(4) + + " [data-section='" + message.args[0] + "']" + ); + + if (section) + { + // Switch to the corresponding tab and scroll to the section. + tab.click(); + section.scrollIntoView(); + + // Focus the first UI element inside the section. + var walker = document.createTreeWalker(section, NodeFilter.SHOW_ELEMENT); + do + walker.currentNode.focus(); + while (walker.currentNode != document.activeElement && walker.nextNode()) + } + } break; } break;