mirror of
https://github.com/swartzrock/obsidian-settings-float-plugin.git
synced 2026-07-22 07:48:42 +00:00
Merge pull request #12 from swartzrock/codex/fix-color-picker-window-drag
Fixed the color-picker selection bug
This commit is contained in:
commit
9ca9ed71a9
2 changed files with 45 additions and 0 deletions
|
|
@ -28,6 +28,7 @@ const NON_DRAGGABLE_SELECTOR = [
|
|||
".clickable-icon",
|
||||
".slider",
|
||||
".dropdown",
|
||||
".pcr-app",
|
||||
"[data-setmove-role='resize-handle']",
|
||||
"[data-setmove-role='preset-control']",
|
||||
].join(", ");
|
||||
|
|
|
|||
|
|
@ -245,6 +245,50 @@ describe("modal enhancer interactions", () => {
|
|||
enhancer.destroy();
|
||||
});
|
||||
|
||||
it("does not drag from a custom color picker", () => {
|
||||
const match = createSettingsFixture({
|
||||
extraContent: `
|
||||
<div class="pcr-app" role="window" aria-label="Color picker dialog">
|
||||
<div class="pcr-selection">
|
||||
<div class="pcr-color-palette">
|
||||
<div class="pcr-palette" role="listbox" aria-label="Color selection area"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
});
|
||||
const onGeometryPersist = vi.fn();
|
||||
const enhancer = enhanceSettingsModal(match, {
|
||||
settings: {
|
||||
...DEFAULT_SETTINGS,
|
||||
},
|
||||
onGeometryPersist,
|
||||
});
|
||||
|
||||
stubPointerCapture(match.modalEl);
|
||||
|
||||
const palette = match.modalEl.querySelector<HTMLElement>(".pcr-palette");
|
||||
if (!palette) {
|
||||
throw new Error("Missing color picker palette");
|
||||
}
|
||||
|
||||
palette.dispatchEvent(
|
||||
pointerEvent("pointerdown", { pointerId: 23, clientX: 20, clientY: 20 }),
|
||||
);
|
||||
palette.dispatchEvent(
|
||||
pointerEvent("pointermove", { pointerId: 23, clientX: 120, clientY: 100 }),
|
||||
);
|
||||
palette.dispatchEvent(
|
||||
pointerEvent("pointerup", { pointerId: 23, clientX: 120, clientY: 100 }),
|
||||
);
|
||||
|
||||
expect(match.modalEl.style.left).toBe("270px");
|
||||
expect(match.modalEl.style.top).toBe("130px");
|
||||
expect(onGeometryPersist).not.toHaveBeenCalled();
|
||||
|
||||
enhancer.destroy();
|
||||
});
|
||||
|
||||
it("persists geometry after resize and clamps it into the host bounds", () => {
|
||||
const match = createSettingsFixture();
|
||||
const onGeometryPersist = vi.fn();
|
||||
|
|
|
|||
Loading…
Reference in a new issue