Skip to content
Open
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
5 changes: 5 additions & 0 deletions .changeset/lucky-doors-wander.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@frontify/fondue-components': patch
---

Fix `Textarea` with `autosize` overflowing its container horizontally when the value contains a long word with no spaces.
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,20 @@ test('autosize functionality', async ({ mount }) => {
await expect(component).toHaveAttribute('data-autosize', 'true');
});

test('autosize does not overflow its container on a long word without spaces', async ({ mount }) => {
const longWord = 'Helloeveryoneandwelcometomyveryverylongwordthatissolongthatitwillprobablyoverflowthecontainer';
const wrapper = await mount(
<div style={{ width: '200px' }}>
<Textarea data-test-id={`${TEXTAREA_TEST_ID}-long-word`} autosize value={longWord} />
<Textarea data-test-id={`${TEXTAREA_TEST_ID}-single-line`} autosize value="short" />
</div>,
);
const longWordComponent = wrapper.getByTestId(`${TEXTAREA_TEST_ID}-long-word`);
const wrappedBox = await longWordComponent.boundingBox();
const singleLineBox = await wrapper.getByTestId(`${TEXTAREA_TEST_ID}-single-line`).boundingBox();
expect(wrappedBox?.height ?? 0).toBeGreaterThan(singleLineBox?.height ?? 0);
});

test('render resize handle when resizable', async ({ mount }) => {
const wrapper = await mount(<Textarea data-test-id={TEXTAREA_TEST_ID} resizable />);
await expect(wrapper.getByTestId(`${TEXTAREA_TEST_ID}-resize-handle`)).toBeVisible();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
.root[data-autosize='true'] .textareaWrapper::after {
content: attr(data-replicated-value) " ";
white-space: pre-wrap;
overflow-wrap: anywhere;
visibility: hidden;
padding-inline-start: sizeToken.get(3);
padding-inline-end: sizeToken.get(3);
Expand Down