Skip to content

Commit

Permalink
Open top most hit when hitting enter in search form
Browse files Browse the repository at this point in the history
fixes #195
  • Loading branch information
kesselborn committed Apr 1, 2018
1 parent d29006a commit b87d3db
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions conex-browser-action.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const keyDownHandling = function(event) {
$1('.delete-container-button', event.target).click();
}
} else if(event.key == 'Enter') {
console.error('unhandled active element:', document.activeElement);
console.error('unhandled keydown active element:', document.activeElement);
return false;
}
}
Expand All @@ -45,8 +45,20 @@ const keyPressHandling = function(event) {
return;
} else if(document.activeElement.dataset.cookieStore) { // a container section
bg.switchToContainer(document.activeElement.dataset.cookieStore);
} else if(document.activeElement.id == 'search') { // enter in search form == activate first shown container or tab
for(const e of $('li')) {
if(e.style.display != 'none' && e.dataset.tabId) {
console.log('activateTab', e.dataset.tabId, e);
bg.activateTab(e.dataset.tabId);
break;
} else if(e.style.display != 'none' && e.className == 'section' && e.tabIndex != "-1") {
console.log(`expandTabContainer (tabindex: ${e.tabIndex})`, e.dataset.cookieStore, e);
bg.switchToContainer(e.dataset.cookieStore);
break;
}
}
} else {
console.error('unhandled active element:', document.activeElement);
console.error('unhandled keypress active element:', document.activeElement);
}
window.close();
} catch(e){console.error(e);}
Expand Down

1 comment on commit b87d3db

@grahamperrin
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NB from #195 (comment):

I expect the initial Tab to focus on the disclosed container – as it already does … sometimes.

Expected, when focus (after one Tab) is on the container

  • (left) should close the container, should rotate the disclosure triangle 90° counterclockwise

Did this commit cause accessibility issue #206? I wonder …

Please sign in to comment.