Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ These notes are publicly posted in [production](https://wordplay.dev/updates), s
### Fixed

- 🌐 Localization edits now say when they're saved, stay on screen after a reload, and the Learn page shows the tutorial in Roman Urdu and Taiwanese Hokkien. (#1495)
- ✍️ Editing a tutorial's text in localization mode now fits inside its speech bubble, so long text wraps instead of being cut off.
- 🤝 Projects shared to a gallery no longer vanish from it when a computer with an old copy of the gallery saves it.
- 💾 The [Projects](https://wordplay.dev/projects) page no longer shows other people's projects that were saved on the same computer.
- 🐛 A project you have open no longer closes with an error when its gallery changes.
Expand Down
11 changes: 10 additions & 1 deletion src/components/editor/markup/MarkupToolbar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,18 @@
>
{/snippet}

<OverflowToolbar items={{ count: shown.length, render: renderItem }} />
<div class="markup-toolbar">
<OverflowToolbar items={{ count: shown.length, render: renderItem }} />
</div>

<style>
/* The toolbar takes the editor's width rather than setting it. A no-wrap row of buttons
is as wide as its buttons, so in a box sized to its content (a tutorial bubble) it
stretched the editor past its column, and then measured that width as room to spare. */
.markup-toolbar {
contain: inline-size;
}

.item {
display: inline-flex;
align-items: stretch;
Expand Down
40 changes: 40 additions & 0 deletions tests/end2end/localize-annotations.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,43 @@ test('the sidebar is unchanged when localization mode is off', async ({
await expect(row).toContainText(conflictName);
await expect(row.getByRole('button', { name: editTip })).toHaveCount(0);
});

/**
* The markup editor's toolbar is a no-wrap row, so it used to set the width of whatever held
* it: in a tutorial bubble it stretched the editor past the dialog column, which a flipped
* bubble overflows toward its start, out of reach — hiding the start of the text and the
* save status beside it. The toolbar must fold its buttons into its menu instead.
*/
test('a tutorial bubble’s editor fits the dialog column', async ({ page }) => {
test.setTimeout(90000);

await page.goto('/en-US/learn?tutorial=complete&act=1&scene=2&pause=5');
await localizeOn(page);
const card = page.locator('button.card').nth(1);
if (await card.isVisible()) await card.click({ position: { x: 8, y: 8 } });

const column = page.locator('.dialog[role="article"]');
const bubble = column.locator('.markup-localizing').first();
await expect(bubble).toBeVisible({ timeout: 30000 });
await bubble.getByRole('button', { name: editTip }).first().click();

const editor = bubble.locator('.markup-editor').first();
await expect(editor).toBeVisible();
// Buttons that don't fit go into the menu rather than widening the bubble.
await expect(
bubble.getByRole('button', {
name: text(enUS.ui.widget.overflow.button.off),
}),
).toBeVisible();

const columnBox = await column.boundingBox();
const editorBox = await editor.boundingBox();
if (columnBox === null || editorBox === null)
throw new Error('No box for the column or the editor.');
expect(editorBox.x).toBeGreaterThanOrEqual(columnBox.x - 1);
expect(editorBox.x + editorBox.width).toBeLessThanOrEqual(
columnBox.x + columnBox.width + 1,
);

await localizeOff(page);
});
Loading