fix(webui): prevent mobile sidebar tooltip and double-tap navigation
Integrate the focused Sheet autofocus and touch hover corrections from #5777 and #5641 on current main. Preserve caller focus overrides, keyboard accessibility, and the existing viewport/safe-area policy. Add App-level coverage for consecutive one-click topic selections and drawer dismissal alongside focus and emitted-CSS regressions. Co-authored-by: Nikko Gonzales <nikkoxgonzales@gmail.com> Co-authored-by: moran <moranfong@gmail.com>
This commit is contained in:
1 parent
d37d7c07c0
commit
13319dfe15
6 files changed
+265
-17
No files matched your search
@@ -0,0 +1,45 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
|
||||
import postcss from "postcss";
|
||||
import tailwindcss from "tailwindcss";
|
||||
import loadConfig from "tailwindcss/loadConfig";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
describe("sidebar touch hover isolation", () => {
|
||||
it("gates ordinary and named-group hover CSS without gating keyboard focus", async () => {
|
||||
const config = loadConfig(resolve(process.cwd(), "tailwind.config.js"));
|
||||
const source = readFileSync(
|
||||
resolve(process.cwd(), "src/components/ChatList.tsx"), "utf8",
|
||||
);
|
||||
const result = await postcss([tailwindcss({
|
||||
...config,
|
||||
content: [{ raw: source, extension: "tsx" }],
|
||||
})]).process("@tailwind utilities;", { from: undefined });
|
||||
const hoverSelectors: string[] = [];
|
||||
const focusSelectors: string[] = [];
|
||||
result.root.walkRules((rule) => {
|
||||
if (rule.selector.includes(":hover")) {
|
||||
hoverSelectors.push(rule.selector);
|
||||
let parent = rule.parent;
|
||||
let hoverMedia = false;
|
||||
while (parent) {
|
||||
if (parent.type === "atrule" && "name" in parent
|
||||
&& parent.name === "media" && parent.params === "(hover: hover)") {
|
||||
hoverMedia = true;
|
||||
}
|
||||
parent = parent.parent;
|
||||
}
|
||||
expect(hoverMedia, rule.selector).toBe(true);
|
||||
}
|
||||
if (rule.selector.includes(":focus-visible")) {
|
||||
focusSelectors.push(rule.selector);
|
||||
expect(rule.parent?.type).toBe("root");
|
||||
}
|
||||
});
|
||||
expect(hoverSelectors.some((selector) => selector.includes("group:hover"))).toBe(true);
|
||||
expect(hoverSelectors.some((selector) => selector.includes("group\\/tab:hover"))).toBe(true);
|
||||
expect(hoverSelectors.some((selector) => selector.includes("group\\/pane:hover"))).toBe(true);
|
||||
expect(focusSelectors.length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user