diff --git a/.changeset/35411-edge-sheet-square-corners.md b/.changeset/35411-edge-sheet-square-corners.md new file mode 100644 index 00000000000..309c7cacc89 --- /dev/null +++ b/.changeset/35411-edge-sheet-square-corners.md @@ -0,0 +1,10 @@ +--- +'@object-ui/console': patch +--- + +fix(console): full-height edge drawers have square corners + +Clause-②: no +Metadata-protocol: none + +- The console stylesheet gave every dialog surface a 1.25rem corner radius, which also rounded the left and right drawers (the notification center, the side form drawer and every other full-height Sheet). Those drawers sit against the top, side and bottom of the window, so the rounding showed as a notch at their inner corners. The rule now skips full-height edge sheets; they render with square corners. The record drawer, a floating card, now shows its own corner radius instead of the global one. Centred dialogs and bottom sheets keep the rounded corners. Drawer width, animation and content are unchanged. diff --git a/ui/apps/console/src/__tests__/edgeSheetSquareCorners-35411.test.tsx b/ui/apps/console/src/__tests__/edgeSheetSquareCorners-35411.test.tsx new file mode 100644 index 00000000000..421a7d2f33c --- /dev/null +++ b/ui/apps/console/src/__tests__/edgeSheetSquareCorners-35411.test.tsx @@ -0,0 +1,119 @@ +/** + * The console's extra-rounded dialog corners skip full-height edge drawers + * (objectstack#35411). + * + * `index.css` gives every `role="dialog"` surface a 1.25rem radius. A left or + * right Sheet is fixed against the top, side and bottom of the viewport, so the + * radius showed as a notch at each inner corner. The rule now skips the Sheet's + * edge variants by the `inset-y-0` class their variant carries, while centred + * dialogs and bottom sheets keep the radius. + * + * The record drawer is the exception: it is a floating card (objectstack#35854) + * that sets its own radius, so the global rule must not override it either. + * + * The selector is read from the shipped stylesheet and matched against the DOM + * the real primitives render, so a change to either side is seen here. + */ +import fs from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { describe, expect, it } from 'vitest'; +import { render, screen } from '@testing-library/react'; +import { + Dialog, + DialogContent, + DialogTitle, + NavigationOverlay, + Sheet, + SheetContent, + SheetTitle, +} from '@object-ui/components'; + +const HERE = path.dirname(fileURLToPath(import.meta.url)); +const CSS = fs.readFileSync(path.resolve(HERE, '../index.css'), 'utf8'); + +const DECLARATION = 'border-radius: 1.25rem !important;'; + +/** + * The selector of the one rule that sets the 1.25rem dialog radius: the text + * between the end of whatever precedes the rule (a closing brace or the + * comment above it) and the rule's opening brace. + */ +function roundingSelector(): string { + const at = CSS.indexOf(DECLARATION); + expect(at).toBeGreaterThan(-1); + expect(CSS.indexOf(DECLARATION, at + 1)).toBe(-1); + const open = CSS.lastIndexOf('{', at); + const start = Math.max(CSS.lastIndexOf('}', open), CSS.lastIndexOf('*/', open) + 1) + 1; + return CSS.slice(start, open).trim(); +} + +function renderSheet(side: 'left' | 'right' | 'bottom' | 'top'): HTMLElement { + render( + + + {`${side} sheet`} + + , + ); + return screen.getByRole('dialog'); +} + +describe('edge sheets are not rounded by the dialog corner rule (#35411)', () => { + it('the rule still targets dialogs', () => { + expect(roundingSelector()).toContain('[role="dialog"]'); + }); + + it.each(['left', 'right'] as const)('a %s sheet is not matched', (side) => { + expect(renderSheet(side).matches(roundingSelector())).toBe(false); + }); + + it.each(['bottom', 'top'] as const)('a %s sheet keeps the rounded corners', (side) => { + expect(renderSheet(side).matches(roundingSelector())).toBe(true); + }); + + it('a centred dialog keeps the rounded corners', () => { + render( + + + centred + + , + ); + expect(screen.getByRole('dialog').matches(roundingSelector())).toBe(true); + }); +}); + +describe('the record drawer keeps its own floating-card radius (#35411, #35854)', () => { + // Renders the real NavigationOverlay drawer. Its own radius is asserted on + // the className it ships: the test DOM has no compiled Tailwind, so the + // utility's computed value is not readable here. + function renderRecordDrawer(): HTMLElement { + render( + {}} + setIsOpen={() => {}} + title="Lead" + width="720px" + mainContent={
} + > + {() =>
record body
} + , + ); + return screen.getByRole('dialog', { name: 'Lead' }); + } + + it('is not matched by the global rounding rule', () => { + const card = renderRecordDrawer(); + expect(card.hasAttribute('data-record-drawer-card')).toBe(true); + expect(card.matches(roundingSelector())).toBe(false); + }); + + it('carries its own radius class', () => { + expect(renderRecordDrawer().className.split(/\s+/)).toContain('sm:rounded-xl'); + }); +}); diff --git a/ui/apps/console/src/index.css b/ui/apps/console/src/index.css index 44658535c47..303259ad430 100644 --- a/ui/apps/console/src/index.css +++ b/ui/apps/console/src/index.css @@ -513,8 +513,11 @@ header.sticky { background-color: hsl(135 59% 49%) !important; } -/* iOS sheet/dialog: extra-rounded corners. */ -[role="dialog"] { +/* iOS sheet/dialog: extra-rounded corners, for surfaces that float or rise from + the bottom. A full-height edge drawer (the left/right Sheet, whose variant + pins it with `inset-y-0`) meets the viewport on three edges, so it keeps + square corners. */ +[role="dialog"]:not(.inset-y-0) { border-radius: 1.25rem !important; }