Skip to content

Commit 1518fd5

Browse files
authored
Merge pull request #370 from eccenca/bugfix/symbols-size-CMEM-7208
Improve display fallback for Unicode symbols (e.g. if used in TabTitle content)
2 parents f2e85ba + 4e46cfd commit 1518fd5

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
2424
- take Markdown rendering into account before testing the maximum preview length
2525
- `<NodeContent />`
2626
- header-menu items are vertically centered now
27+
- `Typography`
28+
- adjust displaying fallback symbols in different browsers
2729

2830
### Changed
2931

src/components/Tabs/stories/TabTitle.stories.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import React from "react";
22
import { Meta, StoryFn } from "@storybook/react";
33

4-
import { Tabs, TabTitle as TabTitleOrg } from "./../../../";
4+
import { Tabs, TabTitle as TabTitleOrg, TabTitleProps } from "./../../../";
55

66
export default {
77
title: "Components/Tabs/TabTitle",
88
component: TabTitleOrg,
99
argTypes: {},
1010
} as Meta<typeof TabTitleOrg>;
1111

12-
const TabTitle = (args) => {
12+
const TabTitle = (args: React.JSX.IntrinsicAttributes & TabTitleProps) => {
1313
return (
1414
<Tabs
1515
id="titledemo"
@@ -31,3 +31,8 @@ TabTitleElement.args = {
3131
titlePrefix: "[",
3232
titleSuffix: <span>]</span>,
3333
};
34+
35+
export const TabTitleSymbolElement = TemplateFull.bind({});
36+
TabTitleSymbolElement.args = {
37+
text: "★",
38+
};

src/components/Typography/_reset.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ select,
77
input,
88
textarea {
99
font-family: inherit;
10+
font-size-adjust: inherit;
1011
border-radius: 0;
1112
}
1213

src/components/Typography/typography.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ body {
1717
text-rendering: optimizelegibility;
1818
-webkit-font-smoothing: antialiased;
1919
-moz-osx-font-smoothing: grayscale;
20+
// User-facing text may contain Unicode symbols (e.g. "★") that fall outside the primary font stack.
21+
// Browsers pick different system fallback fonts for such characters, causing glyphs to render at
22+
// different optical sizes (smaller in Firefox). font-size-adjust normalises the fallback font size
23+
// by matching the primary font's x-height, reducing the visual size discrepancy across browsers.
24+
font-size-adjust: from-font;
2025
}
2126

2227
code {

0 commit comments

Comments
 (0)