mirror of
https://github.com/GoogleChrome/chrome-extensions-samples.git
synced 2026-03-27 13:29:34 +07:00
Fix direction of the keys. (#1080)
This commit is contained in:
@@ -13,9 +13,9 @@ chrome.commands.onCommand.addListener(async (command) => {
|
||||
const lastTab = tabs.length - 1;
|
||||
let newIndex = -1;
|
||||
if (command === 'flip-tabs-forward') {
|
||||
newIndex = activeIndex === 0 ? lastTab : activeIndex - 1;
|
||||
newIndex = activeIndex === lastTab ? 0 : activeIndex + 1;
|
||||
}
|
||||
// 'flip-tabs-backwards'
|
||||
else newIndex = activeIndex === lastTab ? 0 : activeIndex + 1;
|
||||
else newIndex = activeIndex === 0 ? lastTab : activeIndex - 1;
|
||||
chrome.tabs.update(tabs[newIndex].id, { active: true, highlighted: true });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user