Skip to content

Commit 322f73f

Browse files
authored
Merge pull request #857 from IQSS/839-wrappers-break-when-entering-long-descriptions-without-spacing-on-datasets
Fix: add line break to all items' title and description for long text w/o spacing
2 parents a3f4b8b + d681473 commit 322f73f

File tree

8 files changed

+26
-0
lines changed

8 files changed

+26
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ This changelog follows the principles of [Keep a Changelog](https://keepachangel
1414

1515
### Fixed
1616

17+
- Add word-break to items text to prevent layout issues when long descriptions without spaces are entered. (#839)
1718
- Show toast notification when API token is copied to clipboard.
1819

1920
### Removed

src/sections/collection/collection-items-panel/filter-panel/facets-filters/FacetsFilters.module.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
.facets-list {
1111
padding-top: 1rem;
12+
word-break: break-word;
1213

1314
&:empty {
1415
padding-top: 0;

src/sections/collection/collection-items-panel/items-list/collection-card/CollectionCard.module.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
display: flex;
1616
gap: 1rem;
1717
justify-content: space-between;
18+
word-break: break-word;
1819

1920
a {
2021
@include link-hover-underlined;

src/sections/collection/collection-items-panel/items-list/dataset-card/DatasetCard.module.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
padding: 6px 10px;
1111
border: 1px solid $dv-dataset-border-color;
1212
border-radius: 4px;
13+
word-break: break-word;
1314
}
1415

1516
.card-header-container {

src/sections/collection/collection-items-panel/items-list/file-card/FileCard.module.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
padding: 6px 10px;
1111
border: 1px solid $dv-file-border-color;
1212
border-radius: 4px;
13+
word-break: break-word;
1314
}
1415

1516
.card-header-container {

src/sections/shared/citation/Citation.module.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
.description {
44
margin-bottom: 1em;
5+
word-break: break-word;
56
}
67

78
.text {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.breadcrumb-generator {
22
padding-top: 0.5rem;
3+
word-break: break-word;
34
}

tests/component/sections/collection/collection-items-panel/collection-card/CollectionCard.spec.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ describe('CollectionCard', () => {
2727

2828
cy.findByAltText(collectionPreview.name).should('exist')
2929
})
30+
3031
it('should render the card with user roles', () => {
3132
const userRoles = ['Admin', 'Contributor', 'Curator']
3233
const collectionPreview = CollectionItemTypePreviewMother.create({ userRoles: userRoles })
@@ -37,4 +38,22 @@ describe('CollectionCard', () => {
3738
cy.findByText(role).should('exist')
3839
})
3940
})
41+
42+
it('should not overflow horizontally with long unspaced titles', () => {
43+
const longName = 'abc'.repeat(50)
44+
const collectionPreview = CollectionItemTypePreviewMother.create({
45+
name: longName
46+
})
47+
48+
cy.customMount(
49+
<CollectionCard collectionPreview={collectionPreview} parentCollectionAlias="" />
50+
)
51+
52+
cy.contains(longName).should('exist')
53+
// Ensure the title wraps within the available width (no horizontal overflow)
54+
cy.get('[data-testid="collection-card"] header a').then(($a) => {
55+
const el = $a[0]
56+
expect(el.scrollWidth).to.be.lte(el.clientWidth)
57+
})
58+
})
4059
})

0 commit comments

Comments
 (0)