diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f401bfe..b495c8a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ ### 🐞 Bug fixes - Keep the color picker within the viewport when opening it near an edge, scrolling, or resizing. +- Open the color picker when clicking a color field's swatch, not only its text input. - Apply layer renames when pressing Enter or leaving the ID field to avoid validating and saving the style on every keystroke. - Add distinct screen reader labels for the anchor, X offset, and Y offset in each variable anchor offset row. - Open `icon-padding` expressions in the expression editor so they can be viewed and edited. diff --git a/e2e/layer-editor.spec.ts b/e2e/layer-editor.spec.ts index 07e7449a..5d1d8b00 100644 --- a/e2e/layer-editor.spec.ts +++ b/e2e/layer-editor.spec.ts @@ -178,6 +178,14 @@ describe("layer editor", () => { }); }); + test("opens the color picker when the color swatch is clicked, same as the text input", async () => { + const bgId = await createBackground(); + await when.click("layer-list-item:background:" + bgId); + await when.clickColorSwatch("background-color"); + + await then(get.colorPicker()).shouldBeVisible(); + }); + test("keeps the whole color picker visible when opened near the bottom", async () => { const bgId = await createBackground(); await when.click("layer-list-item:background:" + bgId); diff --git a/e2e/maputnik-driver.ts b/e2e/maputnik-driver.ts index 6f8e7c57..6401af7d 100644 --- a/e2e/maputnik-driver.ts +++ b/e2e/maputnik-driver.ts @@ -377,6 +377,10 @@ export class MaputnikDriver { await this.helper.get.elementByTestId("spec-field:" + fieldName).locator(".maputnik-color").click(); }, + clickColorSwatch: async (fieldName: string) => { + await this.helper.get.elementByTestId("spec-field:" + fieldName).locator(".maputnik-color-swatch").click(); + }, + openColorPickerAtBottom: async (fieldName: string) => { const input = this.helper.get.elementByTestId("spec-field:" + fieldName).locator(".maputnik-color"); await input.evaluate(element => element.scrollIntoView({ block: "end" })); diff --git a/src/components/InputColor.tsx b/src/components/InputColor.tsx index 4b570e8a..63e173b4 100644 --- a/src/components/InputColor.tsx +++ b/src/components/InputColor.tsx @@ -163,7 +163,7 @@ export class InputColor extends React.Component {this.state.pickerOpened && picker} -
+