Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
b0d2ca4
refactor(ui): migrate antd Typography to core Typography
shah-harshit Sep 28, 2026
af50003
test(ui): provide core Typography in partial core-components mocks
shah-harshit Sep 28, 2026
1a0f525
Merge branch 'main' into refactor/antd-typography-to-core
shah-harshit Sep 28, 2026
c161121
fix(ui-core): default rel on target=_blank Typography links
shah-harshit Sep 28, 2026
f857c69
Merge remote-tracking branch 'origin/refactor/antd-typography-to-core…
shah-harshit Sep 28, 2026
f22f41d
refactor(ui): use core Typography as-is instead of antd-parity variants
shah-harshit Sep 28, 2026
cd3358e
fix(ui-core): detect truncation on the clipping inner element
shah-harshit Sep 28, 2026
af31369
Merge remote-tracking branch 'origin/main' into refactor/antd-typogra…
shah-harshit Sep 28, 2026
e4b90f2
test(ui): reopen Add Test Cases filter dropdown when it closes before…
shah-harshit Sep 28, 2026
50f25d5
fix(ui-core): keep core Typography word-wrap as on main; wrap only lo…
shah-harshit Sep 28, 2026
dc69d27
refactor(ui): drop dead antd typography selectors, use core props for…
shah-harshit Sep 29, 2026
410c711
Merge branch 'main' into refactor/antd-typography-to-core
shah-harshit Sep 29, 2026
7bfcfe7
Merge remote-tracking branch 'origin/main' into refactor/antd-typogra…
shah-harshit Sep 30, 2026
f776481
fix(ui): restore antd typography parity after core Typography migration
shah-harshit Sep 30, 2026
56f7ae1
fix(ui): restore antd text colour and spacing at migrated Typography …
shah-harshit Sep 30, 2026
08549a1
fix(ui): restore text colour and spacing on Typography sites rendered…
shah-harshit Sep 30, 2026
2c68489
fix(ui): restore typography parity in modals, forms and non-admin views
shah-harshit Sep 30, 2026
03f4f3b
Merge remote-tracking branch 'origin/main' into refactor/antd-typogra…
shah-harshit Sep 30, 2026
bc4257c
chore(playwright): auto-refresh impact-map.generated.json
github-actions[bot] Sep 30, 2026
59b49cd
Merge remote-tracking branch 'origin/main' into refactor/antd-typogra…
shah-harshit Oct 1, 2026
b418abe
Merge remote-tracking branch 'origin/main' into refactor/antd-typogra…
shah-harshit Oct 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import { fireEvent, render, screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { describe, expect, it, vi } from 'vitest';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { Typography } from './typography';

describe('Typography', () => {
Expand Down Expand Up @@ -143,7 +143,78 @@ describe('Typography', () => {
});
});

const mockOverflow = (overflowing: boolean) => {
vi.spyOn(HTMLElement.prototype, 'clientWidth', 'get').mockReturnValue(100);
vi.spyOn(HTMLElement.prototype, 'scrollWidth', 'get').mockReturnValue(
overflowing ? 200 : 100
);
};

describe('Typography ellipsis tooltip', () => {
beforeEach(() => mockOverflow(true));

afterEach(() => {
vi.restoreAllMocks();
});

it('does not show the tooltip when the text is not truncated', async () => {
mockOverflow(false);
const user = userEvent.setup();

render(
<Typography ellipsis={{ tooltip: 'Full text' }}>Short text</Typography>
);

fireEvent.mouseMove(document);
await user.hover(screen.getByText('Short text'));
await new Promise((resolve) => setTimeout(resolve, 500));

expect(screen.queryByText('Full text')).not.toBeInTheDocument();
});

it('keeps an inline ellipsis in the text flow', () => {
render(<Typography ellipsis>Inline text</Typography>);

const wrapper = screen.getByText('Inline text').parentElement;

expect(wrapper?.tagName).toBe('SPAN');
expect(wrapper).toHaveClass('tw:inline-block', 'tw:max-w-full');
});

it('shows the tooltip when only a block inner element overflows', async () => {
vi.restoreAllMocks();
vi.spyOn(HTMLElement.prototype, 'clientWidth', 'get').mockReturnValue(100);
vi.spyOn(HTMLElement.prototype, 'scrollWidth', 'get').mockImplementation(
function (this: HTMLElement) {
return this.tagName === 'P' ? 200 : 100;
}
);
const user = userEvent.setup();

render(
<Typography as="p" ellipsis={{ tooltip: 'Full text' }}>
Clipped paragraph
</Typography>
);

fireEvent.mouseMove(document);
await user.hover(screen.getByText('Clipped paragraph'));

await waitFor(() => {
expect(screen.getByText('Full text')).toBeInTheDocument();
});
});

it('keeps a block wrapper for block elements', () => {
render(
<Typography ellipsis as="p">
Block text
</Typography>
);

expect(screen.getByText('Block text').parentElement?.tagName).toBe('DIV');
});

it('propagates a click through to an ancestor onClick handler', () => {
const handleAncestorClick = vi.fn();

Expand Down Expand Up @@ -244,4 +315,33 @@ describe('Typography ellipsis tooltip', () => {

expect(handleAncestorClick).toHaveBeenCalledTimes(1);
});
it('keeps the parent text alignment inside the tooltip trigger button', () => {
render(<Typography ellipsis={{ tooltip: true }}>Left text</Typography>);

expect(screen.getByText('Left text').closest('button')).toHaveClass(
'tw:[text-align:inherit]'
);
});

it('lays out an inline ellipsis trigger as inline-flex', () => {
render(<Typography ellipsis={{ tooltip: true }}>Inline text</Typography>);

const trigger = screen.getByText('Inline text').closest('button');

expect(trigger).toHaveClass('tw:inline-flex');
expect(trigger).not.toHaveClass('tw:inline-block');
});

it('marks the root so nested links skip prose link styling', () => {
render(
<Typography>
<a href="/x">Link</a>
</Typography>
);

expect(screen.getByText('Link').parentElement).toHaveClass(
'prose',
'prose-typography'
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@

import { Tooltip } from '@/components/base/tooltip/tooltip';
import { cx } from '@/utils/cx';
import type {
ElementType,
HTMLAttributeAnchorTarget,
HTMLAttributes,
ReactNode,
Ref,
import {
type ElementType,
type HTMLAttributeAnchorTarget,
type HTMLAttributes,
type ReactNode,
type Ref,
useRef,
useState,
} from 'react';
import type { PressEvent } from 'react-aria-components';

Expand Down Expand Up @@ -118,6 +120,33 @@ interface TypographyProps extends HTMLAttributes<HTMLElement> {
// below, which TypeScript then resolves to an arbitrary intrinsic element.
const UNWRAPPED_ELEMENTS = new Set<unknown>(['span', 'div']);

// Ellipsis on these keeps them in the text flow (inline-block, capped at the
// container width) instead of breaking the line with a block wrapper.
const INLINE_ELEMENTS = new Set<unknown>(['span', 'a']);

const overflows = (el: Element | null, rows: number) =>
!!el &&
(rows > 1
? el.scrollHeight > el.clientHeight
: el.scrollWidth > el.clientWidth);

// The clamp classes sit on both the wrapper and the inner element. A block
// inner element clips its own overflow, so the wrapper never sees it — check
// the inner element too.
const isTruncated = (wrapper: HTMLElement | null, rows: number) =>
overflows(wrapper, rows) ||
overflows(wrapper?.firstElementChild ?? null, rows);

// Marks a Typography root so `styles/typography.css` can keep article-prose
// link styling (always underlined, weight 400) off links nested in UI text.
const TYPOGRAPHY_ROOT = 'prose-typography';

// The tooltip trigger is a <button>, whose UA `text-align: center` would
// otherwise centre short text; cursor-[inherit] likewise overrides the UA
// `cursor: default`, which would beat a clickable ancestor's pointer.
const TOOLTIP_TRIGGER =
'tw:min-w-0 tw:cursor-[inherit] tw:[text-align:inherit]';

const quoteStyles: Record<TypographyQuoteVariant, string> = {
default: '',
'centered-quote': 'prose-centered-quote',
Expand Down Expand Up @@ -170,6 +199,9 @@ export const Typography = (props: TypographyProps) => {
...otherProps
} = props;

const wrapperRef = useRef<HTMLDivElement>(null);
Comment thread
shah-harshit marked this conversation as resolved.
Resolved
const [isEllipsisTooltipOpen, setIsEllipsisTooltipOpen] = useState(false);

const sizeClass = size ? sizeClasses[size] : undefined;
const weightClass = weight ? weightClasses[weight] : undefined;
const colorClass = color ? colorClasses[color] : undefined;
Expand Down Expand Up @@ -218,27 +250,56 @@ export const Typography = (props: TypographyProps) => {
const element = (
<Component
{...otherProps}
className={canUnwrap ? cx('prose', innerClassName) : innerClassName}
className={
canUnwrap
? cx('prose', TYPOGRAPHY_ROOT, innerClassName)
: innerClassName
}
style={style}>
{children}
</Component>
);

const isInlineEllipsis = isEllipsis && INLINE_ELEMENTS.has(Component);
const Wrapper = isInlineEllipsis ? 'span' : 'div';

const content = canUnwrap ? (
element
) : (
<div className={cx('prose', quoteStyles[quoteVariant], ellipsisClassName)}>
<Wrapper
className={cx(
'prose',
TYPOGRAPHY_ROOT,
quoteStyles[quoteVariant],
ellipsisClassName,
isInlineEllipsis &&
'tw:inline-block tw:min-w-0 tw:max-w-full tw:align-bottom'
)}
ref={wrapperRef}>
{element}
</div>
</Wrapper>
);

if (ellipsisTooltip) {
return (
<Tooltip
isOpen={isEllipsisTooltipOpen}
title={ellipsisTooltip}
// cursor-[inherit] overrides the UA `cursor: default` the wrapper gets
// for being a button, which would beat a clickable ancestor's pointer.
triggerClassName="tw:block tw:w-full tw:min-w-0 tw:cursor-[inherit]"
triggerClassName={cx(
TOOLTIP_TRIGGER,
isInlineEllipsis
? // inline-flex, not inline-block: an inline-block child would sit
// in the button's own line box, whose inherited line-height adds
// ~2px under the text and shifts everything below it.
'tw:inline-flex tw:max-w-full tw:align-bottom'
: 'tw:block tw:w-full'
)}
onOpenChange={(isOpen) =>
// The full text is only worth a tooltip when it is actually cut off.
setIsEllipsisTooltipOpen(
isOpen && isTruncated(wrapperRef.current, ellipsisRows)
)
}
onTriggerPress={allowEllipsisTooltipPressToPropagate}>
{content}
</Tooltip>
Expand All @@ -249,6 +310,7 @@ export const Typography = (props: TypographyProps) => {
return (
<Tooltip
title={tooltip}
triggerClassName={TOOLTIP_TRIGGER}
onTriggerPress={allowEllipsisTooltipPressToPropagate}>
{content}
</Tooltip>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@
}

/* Inline elements */
&:where(a:not(h1 a, h2 a, h3 a, h4 a, h5 a, h6 a)) {
&:where(a:not(h1 a, h2 a, h3 a, h4 a, h5 a, h6 a, .prose-typography a)) {
font-weight: 400;
text-decoration: underline;
text-underline-offset: 3px;
Expand Down Expand Up @@ -402,7 +402,7 @@
}

/* Inline elements */
&:where(a:not(h1 a, h2 a, h3 a, h4 a, h5 a, h6 a)) {
&:where(a:not(h1 a, h2 a, h3 a, h4 a, h5 a, h6 a, .prose-typography a)) {
font-weight: 400;
text-decoration: underline;
text-underline-offset: 3px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,19 @@
dataStewardPage: Page;
}>({
adminPage: async ({ browser }, use) => {
const adminPage = await browser.newPage();

Check warning on line 124 in openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Users.spec.ts

View workflow job for this annotation

GitHub Actions / checkstyle

Prefer the `page` fixture (test.use({ storageState })) over browser.newPage() + manual login for single-user admin tests. For multi-user tests that need a second non-admin page, this warning is expected — no action needed
await adminUser.login(adminPage);
await use(adminPage);
await adminPage.close();
},
dataConsumerPage: async ({ browser }, use) => {
const page = await browser.newPage();

Check warning on line 130 in openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Users.spec.ts

View workflow job for this annotation

GitHub Actions / checkstyle

Prefer the `page` fixture (test.use({ storageState })) over browser.newPage() + manual login for single-user admin tests. For multi-user tests that need a second non-admin page, this warning is expected — no action needed
await dataConsumerUser.login(page);
await use(page);
await page.close();
},
dataStewardPage: async ({ browser }, use) => {
const page = await browser.newPage();

Check warning on line 136 in openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Users.spec.ts

View workflow job for this annotation

GitHub Actions / checkstyle

Prefer the `page` fixture (test.use({ storageState })) over browser.newPage() + manual login for single-user admin tests. For multi-user tests that need a second non-admin page, this warning is expected — no action needed
await dataStewardUser.login(page);
await use(page);
await page.close();
Expand Down Expand Up @@ -892,7 +892,7 @@

// Get text of all personas to verify sorting
const personaTexts = await personaLabels
.locator('.ant-typography')
.locator('.default-persona-container .prose')
.allTextContents();

// Verify first one contains the default persona name
Expand Down Expand Up @@ -930,7 +930,7 @@
// Get the current default persona name for later verification
const originalDefaultPersonaText = await personaLabels
.first()
.locator('.ant-typography')
.locator('.default-persona-container .prose')
.textContent();

// Close dropdown
Expand Down Expand Up @@ -981,7 +981,7 @@
);
const newDefaultPersonaLocator = updatedPersonaLabels
.first()
.locator('.ant-typography');
.locator('.default-persona-container .prose');

await expect(newDefaultPersonaLocator).toContainText(
persona2.responseData.displayName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,27 @@ export interface AddTestCaseListFilterContext {
waitAfterFilterUpdate: () => Promise<void>;
}

export function waitForAddTestCaseListTableSearchQuery(
// The filter dropdown is a popover rendered outside the Add Test Cases modal
// and can close again right after it opens (timing-dependent). Reopen and
// retype until the searched option is shown instead of racing that close.
async function searchAddTestCaseListFilterOption(
page: Page,
tableEntityName: string
searchKey: string,
searchText: string,
optionTestId: string
) {
return page.waitForResponse((res) => {
const u = res.url();
if (res.request().method() !== 'GET') {
return false;
}
if (!u.includes('/api/v1/search/query')) {
return false;
}
if (!/[?&]index=table(?:&|$)/.test(u)) {
return false;
}
if (!tableEntityName) {
return false;
const menu = page.getByTestId('drop-down-menu');
const option = menu.getByTestId(optionTestId);

await expect(async () => {
if (!(await menu.isVisible())) {
await page.getByTestId(`search-dropdown-${searchKey}`).click();
}
return (
u.includes(encodeURIComponent(tableEntityName)) ||
u.includes(tableEntityName)
);
});
await menu.getByTestId('search-input').fill(searchText, { timeout: 5_000 });
await expect(option).toBeVisible({ timeout: 10_000 });
}).toPass({ timeout: 60_000 });

return option;
}

export async function addTestCaseListFilterByTestType(
Expand Down Expand Up @@ -84,19 +82,12 @@ export async function addTestCaseListFilterByTable(
tableEntityName: string,
tableFqn: string
) {
const tableSearchResponse = waitForAddTestCaseListTableSearchQuery(
const tableOption = await searchAddTestCaseListFilterOption(
page,
tableEntityName
'Table',
tableEntityName,
tableFqn
);
await page.getByTestId('search-dropdown-Table').click();
await page
.getByTestId('drop-down-menu')
.getByTestId('search-input')
.fill(tableEntityName);
await tableSearchResponse;

const tableOption = page.getByTestId('drop-down-menu').getByTestId(tableFqn);
await tableOption.waitFor({ state: 'visible' });
await tableOption.click();

// Table filter must pair entityLink with includeAllTests=true so column
Expand All @@ -120,16 +111,12 @@ export async function addTestCaseListFilterByColumn(
page: Page,
columnName: string
) {
await page.getByTestId('search-dropdown-Column').click();
await page
.getByTestId('drop-down-menu')
.getByTestId('search-input')
.fill(columnName);

const columnOption = page
.getByTestId('drop-down-menu')
.getByTestId(columnName);
await columnOption.waitFor({ state: 'visible' });
const columnOption = await searchAddTestCaseListFilterOption(
page,
'Column',
columnName,
columnName
);
await columnOption.click();

const testCaseByColumnResponse = page.waitForResponse(
Expand Down
Loading
Loading