Skip to content

Commit d5287d3

Browse files
committed
Displaying symbols as TabTitle content (CMEM-7208)
1 parent f2e85ba commit d5287d3

3 files changed

Lines changed: 15 additions & 2 deletions

File tree

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+
`<TabTitle />`
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/Tabs/tabs.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ $tab-indicator-width: 3px !default;
4646
overflow-x: hidden;
4747
text-overflow: ellipsis;
4848
white-space: nowrap;
49+
// Tab titles are user-configured and may contain Unicode symbols (e.g. "★") that fall outside
50+
// the primary font stack. Browsers pick different system fallback fonts for such characters,
51+
// causing glyphs to render at different optical sizes (smaller in Firefox).
52+
// font-size-adjust normalises the fallback font size by matching the primary font's x-height,
53+
// reducing the visual size discrepancy across browsers.
54+
font-size-adjust: from-font;
4955

5056
//min-width: 6em;
5157
}

0 commit comments

Comments
 (0)