Compare commits

...
4 Commits
6 changed files with 43 additions and 2 deletions

No files matched your search

+2 -1
View File
@@ -47,7 +47,8 @@
"useGenericFontNames": "off",
"useKeyWithClickEvents": "off",
"useMediaCaption": "off",
"useSemanticElements": "off"
"useSemanticElements": "off",
"useValidAnchor": "off"
},
"complexity": {
"noForEach": "on",
@@ -63,4 +63,13 @@ describe("ContextMenu in advanced search", () => {
expect(toggle(false)).toBe(true);
expect(toggle(true)).toBe(false);
});
it("hides Share when nothing is selected, since the results listing has no folder to share", () => {
const share = (isAdvancedSearch, selectedCount) =>
computed.showShareAction.call({ showLimitedOptions: false, isAdvancedSearch, selectedCount, showShare: true });
expect(share(true, 0)).toBe(false);
expect(share(true, 1)).toBe(true);
expect(share(true, 2)).toBe(false);
expect(share(false, 0)).toBe(true);
});
});
+2
View File
@@ -423,6 +423,8 @@ export default {
},
showShareAction() {
if (this.showLimitedOptions) return false;
// Advanced search results have no folder of their own to share, only the selected results do.
if (this.isAdvancedSearch && this.selectedCount === 0) return false;
return this.selectedCount <= 1 && this.showShare;
},
showSendToApp() {
@@ -0,0 +1,21 @@
import { afterEach, describe, expect, it, vi } from "vitest";
import { createApp, h } from "vue";
vi.mock("@/store", () => ({ state: { sources: {} }, mutations: { showPrompt: vi.fn() } }));
vi.mock("@/store/eventBus", () => ({ eventBus: { on: vi.fn(), off: vi.fn() } }));
import PathPickerButton from "./PathPickerButton.vue";
describe("PathPickerButton keyboard access", () => {
let app;
afterEach(() => app?.unmount());
it("can be focused and is exposed as a button, so its Enter and Space handlers can run", () => {
const el = document.createElement("div");
app = createApp({ render: () => h(PathPickerButton, { path: "/", source: "" }) });
app.config.globalProperties.$t = (key) => key;
app.mount(el);
const picker = el.querySelector(".unified-path-picker");
expect(picker.getAttribute("tabindex")).toBe("0");
expect(picker.getAttribute("role")).toBe("button");
});
});
@@ -1,6 +1,8 @@
<template>
<div
:aria-label="resolvedAriaLabel"
tabindex="0"
role="button"
class="searchContext clickable button unified-path-picker"
@click="openPicker"
@keydown.enter.prevent="openPicker"
@@ -170,4 +172,10 @@ export default {
overflow-wrap: break-word;
box-sizing: border-box;
}
/* .button removes the outline, so keyboard focus needs its own indicator. */
.unified-path-picker:focus-visible {
outline: 2px solid var(--primaryColor);
outline-offset: 2px;
}
</style>
+1 -1
View File
@@ -17,7 +17,7 @@
>close</i>
</div>
<div v-if="showPwaInstall" class="button release-banner">
<button type="button" @click="installPwa">{{ $t("pwa.install") }}</button>
<a type="button" @click="installPwa">{{ $t("pwa.install") }}</a>
<i @click="dismissPwaInstall" role="button" tabindex="0" aria-label="close-banner" class="material-symbols">close</i>
</div>
<SidebarSettings v-if="isSettings"></SidebarSettings>