Free, open-source screen sharing for private live streams with friends. Watch together in a browser or self-host Piik. 免费开源的私密屏幕共享,支持游戏直播、一起看电影与自部署。
import type { KeyboardEvent } from "react";
// Small, immediately available content pages share automatic tab activation.
// Selection and panel lifetime stay with the component that owns the content.
export function navigateTabs(event: KeyboardEvent<HTMLElement>): void {
if (event.altKey || event.ctrlKey || event.metaKey) return;
const tabs = Array.from(event.currentTarget.querySelectorAll<HTMLButtonElement>('[role="tab"]:not(:disabled)'));
const current = tabs.indexOf(event.target as HTMLButtonElement);
if (current < 0) return;
const next = event.key === "Home" ? 0 : event.key === "End" ? tabs.length - 1
: event.key === "ArrowRight" ? (current + 1) % tabs.length
: event.key === "ArrowLeft" ? (current + tabs.length - 1) % tabs.length : -1;
if (next < 0) return;
event.preventDefault();
tabs[next].focus();
tabs[next].click();
}