fix(design-system): replace hand-rolled diff draft-card shadow with shadow-xs (#23307)

The inline AI-note draft card in the diff view used a fourth, hand-rolled
box-shadow tier with raw rgba values instead of the documented shadow-xs
token, so it didn't track theme/token updates like the rest of the UI.
Restated the value under `.dark` too, since it shares selector specificity
with `.orca-diff-comment-popover`'s dark shadow later in the file and would
otherwise lose the cascade to that unrelated rule.
This commit is contained in:
Neil
2026-09-26 20:56:41 -07:00
committed by GitHub
parent 98cfdc809f
commit 067844b646
2 changed files with 45 additions and 6 deletions
@@ -0,0 +1,39 @@
import fs from 'node:fs'
import { describe, expect, it } from 'vitest'
const mainCss = fs.readFileSync(new URL('./main.css', import.meta.url), 'utf8')
function getCssRuleBody(selector: string): string {
const ruleMarker = mainCss.indexOf(`\n${selector} {`)
expect(ruleMarker).toBeGreaterThanOrEqual(0)
const ruleStart = ruleMarker + 1
const bodyStart = mainCss.indexOf('{', ruleStart) + 1
const bodyEnd = mainCss.indexOf('}', bodyStart)
return mainCss.slice(bodyStart, bodyEnd)
}
describe('diff comment draft card shadow', () => {
it('uses the documented shadow-xs tier instead of a hand-rolled fourth tier', () => {
const draftCard = getCssRuleBody('.orca-diff-comment-inline > .orca-diff-comment-draft-card')
// STYLEGUIDE.md caps elevation at border / shadow-xs / shadow-floating —
// no invented per-component shadow values.
expect(draftCard).toContain('shadow-xs')
expect(draftCard).not.toMatch(/box-shadow:\s*\n?\s*0/)
expect(draftCard).not.toContain('rgba(0, 0, 0,')
})
it('keeps the dark override at shadow-xs, not a hand-rolled or missing shadow', () => {
const darkDraftCard = getCssRuleBody(
'.dark .orca-diff-comment-inline > .orca-diff-comment-draft-card'
)
// Same selector specificity as `.dark .orca-diff-comment-popover` (its
// ancestor via the shared draft-card component), which sits later in the
// file — dropping this rule lets that popover's much larger floating
// shadow win the cascade in dark mode instead of shadow-xs.
expect(darkDraftCard).toContain('shadow-xs')
expect(darkDraftCard).not.toContain('rgba(0, 0, 0,')
})
})
+6 -6
View File
@@ -2863,6 +2863,10 @@ html.native-shell .app-layout {
max-width: 420px;
}
/* Why: embedded card in the diff flow, not a floating popup — use the
documented "subtle lift" tier (shadow-xs) rather than a hand-rolled shadow.
Restated under `.dark` (same value) so this still outranks the base
`.orca-diff-comment-popover` dark shadow at equal selector specificity. */
.orca-diff-comment-inline > .orca-diff-comment-draft-card {
position: relative;
left: auto;
@@ -2870,15 +2874,11 @@ html.native-shell .app-layout {
width: 100%;
max-width: 420px;
z-index: 1;
box-shadow:
0 2px 6px rgba(0, 0, 0, 0.08),
0 4px 12px rgba(0, 0, 0, 0.08);
@apply shadow-xs;
}
.dark .orca-diff-comment-inline > .orca-diff-comment-draft-card {
box-shadow:
0 2px 6px rgba(0, 0, 0, 0.35),
0 4px 14px rgba(0, 0, 0, 0.28);
@apply shadow-xs;
}
.orca-diff-comment-draft-margin {