← All examples

JavaScript Navigation bsky.app

Bluesky: keys 1-9 switch between pinned feeds

Lets you jump between feed tabs at the top by pressing 1-9 according to their position.

Code to copy

// Number keys 1-9 jump between pinned feed tabs at the top
(function () {
  function tabs() {
    var bar = document.querySelector(
      '[data-testid="homeScreenFeedTabs"], [data-testid="feedsTabBar"], [role="tablist"]'
    );
    if (!bar) { return []; }
    return Array.from(bar.querySelectorAll('[role="tab"], a[role="link"]'));
  }
  document.addEventListener('keydown', function (e) {
    var t = e.target;
    if (t && (t.isContentEditable || /^(INPUT|TEXTAREA)$/.test(t.tagName))) { return; }
    if (e.ctrlKey || e.metaKey || e.altKey) { return; }
    if (e.key < '1' || e.key > '9') { return; }
    var list = tabs();
    var idx = parseInt(e.key, 10) - 1;
    if (list[idx]) {
      list[idx].click();
      e.preventDefault();
    }
  });
})();

How to use this example

  1. Copy the code with the button above.
  2. Install JustZix (2 minutes) and open the extension on the target page.
  3. Add a new rule matching that page.
  4. Paste the code into the rule's JavaScript panel and save — it runs on every page visit.

Rate this example

No ratings yet — be the first.

Does this example work?

Snippets are useless without somewhere to paste them.

JustZix takes 2 minutes to install and runs your code on every matching page. No account, no payment.

Download free See use cases