Skip to content

Commit a4c1cc5

Browse files
committed
fix: Remove underline from trailing whitespace in external links
Removes the non-breaking space that caused underlines to appear below trailing whitespace between external icon and link text. Replaces it with margin-inline-start. AWSUI-60840
1 parent 5730732 commit a4c1cc5

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

src/link/internal.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ const InternalLink = React.forwardRef(
186186
{children}
187187
{external && (
188188
<span className={styles['icon-wrapper']}>
189-
&nbsp;
190189
<span
191190
className={styles.icon}
192191
aria-label={renderedExternalIconAriaLabel}

src/link/styles.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@
5858

5959
.icon-wrapper {
6060
white-space: nowrap;
61+
/* Add non-breaking space for consistent spacing */
62+
&::before {
63+
content: '\a0';
64+
display: inline-block;
65+
}
6166
}
6267

6368
.icon {

src/pie-chart/__integ__/with-links.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ describe('Pie chart with links in key-value pairs', () => {
2020
const expectedFocusedText =
2121
linksIn === 'keys'
2222
? // The external link icon adds an extra space at the end
23-
'Popularity '
24-
: '50% ';
23+
'Popularity'
24+
: '50%';
2525
await page.click('#focus-target');
2626
await page.keys(['Tab']); // Focus the chart
2727
await page.keys(['Enter']); // Focus the first chart segment

src/top-navigation/__integ__/top-navigation.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('Top navigation', () => {
3232
'renders utilities with text',
3333
setupTest(pageWidth, async page => {
3434
await expect(page.getText(wrapper.findUtility(1).toSelector())).resolves.toBe('New thing');
35-
await expect(page.getText(wrapper.findUtility(2).toSelector())).resolves.toBe('Docs ');
35+
await expect(page.getText(wrapper.findUtility(2).toSelector())).resolves.toBe('Docs');
3636
await expect(page.getText(wrapper.findUtility(4).toSelector())).resolves.toBe('John Doe');
3737
})
3838
);
@@ -66,7 +66,7 @@ describe('Top navigation', () => {
6666
await expect(page.getText(wrapper.findUtility(1).toSelector())).resolves.toBe('New thing');
6767

6868
// Docs shouldn't be collapsed because it doesn't have an icon.
69-
await expect(page.getText(wrapper.findUtility(2).toSelector())).resolves.toBe('Docs ');
69+
await expect(page.getText(wrapper.findUtility(2).toSelector())).resolves.toBe('Docs');
7070
})
7171
);
7272
});

0 commit comments

Comments
 (0)