diff --git a/frontend/src/v2/components/GameDetails/FilesTab/FilesTab.vue b/frontend/src/v2/components/GameDetails/FilesTab/FilesTab.vue
index 9d54d4ee7..358ccec45 100644
--- a/frontend/src/v2/components/GameDetails/FilesTab/FilesTab.vue
+++ b/frontend/src/v2/components/GameDetails/FilesTab/FilesTab.vue
@@ -617,11 +617,8 @@ async function refreshRom() {
-
+
({
const RSelect = {
props: {
- modelValue: { type: String, default: "" },
+ modelValue: { type: [String, Object], default: "" },
items: { type: Array, default: () => [] },
},
emits: ["update:modelValue"],
@@ -53,6 +53,8 @@ const RBtn = {
template: ``,
};
+const APPLY = 'button[prepend-icon="mdi-file-cog"]';
+
const archiveMembers: RomArchiveMember[] = [
{
name: "docs/readme.txt",
@@ -106,8 +108,8 @@ describe("PatcherTab", () => {
vi.spyOn(HTMLAnchorElement.prototype, "click").mockImplementation(() => {});
});
- it("sends the selected ZIP member when applying a patch", async () => {
- const wrapper = mount(PatcherTab, {
+ function mountTab() {
+ return mount(PatcherTab, {
props: { rom: rom() },
global: {
stubs: {
@@ -119,7 +121,6 @@ describe("PatcherTab", () => {
RIcon: true,
RPlatformIcon: true,
RSelect,
- RSliderBtnGroup: true,
RTextField: true,
RTooltip: true,
MissingFSBadge: true,
@@ -127,8 +128,12 @@ describe("PatcherTab", () => {
},
},
});
+ }
- const applyButton = wrapper.get("button");
+ it("sends the selected ZIP member when applying a patch", async () => {
+ const wrapper = mountTab();
+
+ const applyButton = wrapper.get(APPLY);
expect(applyButton.attributes("disabled")).toBeDefined();
await wrapper.get("select").setValue("roms/Super Metroid.sfc");
@@ -143,4 +148,33 @@ describe("PatcherTab", () => {
"roms/Super Metroid.sfc",
);
});
+
+ it("keeps an uploaded patch and a bundled one mutually exclusive", async () => {
+ const wrapper = mountTab();
+ await wrapper.get("select").setValue("roms/Super Metroid.sfc");
+ const upload = new File(["ips"], "hack.ips");
+
+ wrapper.findComponent({ name: "RDropzone" }).vm.$emit("files", [upload]);
+ await wrapper.vm.$nextTick();
+ expect(wrapper.find(".r-v2-patch__uploaded").exists()).toBe(true);
+ await wrapper.get(APPLY).trigger("click");
+ await flushPromises();
+
+ const uploadForm = post.mock.calls[0][1] as FormData;
+ expect(uploadForm.get("patch_file")).toBeInstanceOf(File);
+ expect(uploadForm.get("patch_file_id")).toBeNull();
+
+ const bundled = rom().files[1];
+ wrapper
+ .findAllComponents(RSelect)[1]
+ .vm.$emit("update:modelValue", bundled);
+ await wrapper.vm.$nextTick();
+ expect(wrapper.find(".r-v2-patch__uploaded").exists()).toBe(false);
+ await wrapper.get(APPLY).trigger("click");
+ await flushPromises();
+
+ const bundledForm = post.mock.calls[1][1] as FormData;
+ expect(bundledForm.get("patch_file")).toBeNull();
+ expect(bundledForm.get("patch_file_id")).toBe("11");
+ });
});
diff --git a/frontend/src/v2/components/GameDetails/PatcherTab.vue b/frontend/src/v2/components/GameDetails/PatcherTab.vue
index 778d0dd55..6cd530898 100644
--- a/frontend/src/v2/components/GameDetails/PatcherTab.vue
+++ b/frontend/src/v2/components/GameDetails/PatcherTab.vue
@@ -760,14 +760,12 @@ const applyLabel = computed(() => {
text-overflow: ellipsis;
}
-/* Single-file display (no picker) — name + size chip. */
.r-v2-patch__or {
- color: var(--r-color-fg-muted);
- font-size: var(--r-font-size-xs);
text-transform: uppercase;
letter-spacing: 0.1em;
}
+/* Single-file display (no picker): name + size chip. */
.r-v2-patch__file-single {
display: flex;
align-items: center;
diff --git a/frontend/src/v2/components/GameDetails/SubtabNav.test.ts b/frontend/src/v2/components/GameDetails/SubtabNav.test.ts
new file mode 100644
index 000000000..5a760c81b
--- /dev/null
+++ b/frontend/src/v2/components/GameDetails/SubtabNav.test.ts
@@ -0,0 +1,79 @@
+import { mount } from "@vue/test-utils";
+import { describe, expect, it, vi } from "vitest";
+import SubtabNav, { type SubtabNavItem } from "./SubtabNav.vue";
+
+vi.mock("vue-i18n", () => ({
+ useI18n: () => ({ t: (key: string) => key }),
+}));
+
+const RMenu = {
+ props: { searchable: { type: Boolean, default: false } },
+ emits: ["update:search", "update:modelValue"],
+ template: ``,
+};
+const RMenuItem = {
+ props: { label: { type: String, default: "" } },
+ emits: ["click"],
+ template: ``,
+};
+
+const stubs = {
+ RBtn: { template: `` },
+ RDivider: true,
+ RIcon: true,
+ RMenu,
+ RMenuItem,
+};
+
+function nav(items: SubtabNavItem[], props: Record = {}) {
+ return mount(SubtabNav, {
+ props: { modelValue: items[0].id, items, ...props },
+ global: { stubs },
+ });
+}
+
+describe("SubtabNav", () => {
+ it("heads each group once and hides a zero badge", () => {
+ const wrapper = nav([
+ { id: "a", label: "Alpha", group: "Mine", badge: 0 },
+ { id: "b", label: "Beta", group: "Mine", badge: 3 },
+ { id: "c", label: "Gamma", group: "Community" },
+ ]);
+
+ expect(
+ wrapper.findAll(".r-v2-subtab-nav__group").map((g) => g.text()),
+ ).toEqual(["Mine", "Community"]);
+ expect(
+ wrapper.findAll(".r-v2-subtab-nav__badge").map((b) => b.text()),
+ ).toEqual(["3"]);
+ });
+
+ it("emits only when a different subtab is picked", async () => {
+ const wrapper = nav([
+ { id: "a", label: "Alpha" },
+ { id: "b", label: "Beta" },
+ ]);
+ const buttons = wrapper.findAll(".r-v2-subtab-nav__btn");
+
+ await buttons[0].trigger("click");
+ expect(wrapper.emitted("update:modelValue")).toBeUndefined();
+ await buttons[1].trigger("click");
+ expect(wrapper.emitted("update:modelValue")).toEqual([["b"]]);
+ });
+
+ it("offers a filter past eight entries and matches labels loosely", async () => {
+ const items = Array.from({ length: 9 }, (_, i) => ({
+ id: `n${i}`,
+ label: i === 4 ? "Speedrun Route" : `Note ${i}`,
+ }));
+ const wrapper = nav(items, { variant: "menu" });
+ const menu = wrapper.findComponent(RMenu);
+
+ expect(menu.attributes("data-searchable")).toBe("true");
+ menu.vm.$emit("update:search", " ROUTE ");
+ await wrapper.vm.$nextTick();
+ expect(wrapper.findAll(".option").map((o) => o.text())).toEqual([
+ "Speedrun Route",
+ ]);
+ });
+});
diff --git a/frontend/src/v2/components/GameDetails/SubtabNav.vue b/frontend/src/v2/components/GameDetails/SubtabNav.vue
index 688739d72..159585f44 100644
--- a/frontend/src/v2/components/GameDetails/SubtabNav.vue
+++ b/frontend/src/v2/components/GameDetails/SubtabNav.vue
@@ -226,6 +226,14 @@ function select(id: T) {
background: color-mix(in srgb, var(--r-color-brand-primary) 18%, transparent);
color: var(--r-color-brand-primary);
}
+/* The list is a scroll container that clips the global outline ring, so paint
+ the key / pad focus inside the button instead. */
+html:not([data-input]) .r-v2-subtab-nav__btn:focus-visible,
+html[data-input="key"] .r-v2-subtab-nav__btn:focus-visible,
+html[data-input="pad"] .r-v2-subtab-nav__btn:focus-visible {
+ outline: none;
+ box-shadow: inset 0 0 0 2px var(--r-color-focus);
+}
.r-v2-subtab-nav__label {
flex: 1;
}
diff --git a/frontend/src/v2/lib/primitives/RTabNav/RTabNav.vue b/frontend/src/v2/lib/primitives/RTabNav/RTabNav.vue
index 739a029c3..89a8160fd 100644
--- a/frontend/src/v2/lib/primitives/RTabNav/RTabNav.vue
+++ b/frontend/src/v2/lib/primitives/RTabNav/RTabNav.vue
@@ -115,9 +115,8 @@ function updateOverflow() {
overflowEnd.value = track.scrollLeft < maxScroll - 1;
}
-function revealActive(behavior: ScrollBehavior) {
+function reveal(el: HTMLElement | null | undefined, behavior: ScrollBehavior) {
const track = trackEl.value;
- const el = btnEls.get(props.modelValue);
if (!track || !el || props.orientation !== "horizontal") return;
const start = el.offsetLeft - EDGE_PX;
const end = el.offsetLeft + el.offsetWidth + EDGE_PX - track.clientWidth;
@@ -128,6 +127,16 @@ function revealActive(behavior: ScrollBehavior) {
}
}
+function revealActive(behavior: ScrollBehavior) {
+ reveal(btnEls.get(props.modelValue), behavior);
+}
+
+// The browser's own focus scroll stops at the edge, under the fade and chevron.
+function onTrackFocusIn(event: FocusEvent) {
+ const el = event.target as HTMLElement;
+ if (el.matches(":focus-visible")) reveal(el, scrollBehavior());
+}
+
function scrollPage(direction: 1 | -1) {
const track = trackEl.value;
if (!track) return;
@@ -228,6 +237,7 @@ onBeforeUnmount(() => {
ref="trackEl"
class="r-tab-nav__track"
@scroll.passive="updateOverflow"
+ @focusin="onTrackFocusIn"
>