fix(editor): pin completion icon glyph to its box

This commit is contained in:
t8y2 committed 2026-09-03 15:01:31 +08:00
1 parent df244627f6
commit e98e3157f1
2 files changed
+25 -2

No files matched your search

+17
View File
@@ -172,6 +172,23 @@ describe("SQL completion theme", () => {
zIndex: "1", zIndex: "1",
}); });
}); });
it("pins the completion icon glyph to its box so engines cannot clip it", () => {
const rules = buildSqlCompletionThemeRules();
// With `left`/`top` auto, the absolutely positioned pseudo element relies on
// engine-specific static positions inside the flex icon, and WebKit places it
// far enough left for `overflow: hidden` to cut off the left half of the glyph.
expect(rules[".cm-completionIcon:before"]).toMatchObject({
left: "0",
top: "0",
width: "15px",
height: "15px",
maskSize: "14px 14px",
maskPosition: "center",
});
expect(rules[".cm-completionIcon"]).toMatchObject({ width: "15px", height: "15px", overflow: "hidden" });
});
}); });
describe("editor gutters", () => { describe("editor gutters", () => {
+8 -2
View File
@@ -998,7 +998,13 @@ export function buildSqlCompletionThemeRules(): CodeMirrorStyleSpec {
backgroundColor: "currentColor", backgroundColor: "currentColor",
content: "''", content: "''",
display: "block", display: "block",
height: "14px", height: "15px",
// The pseudo element must be pinned to the icon box: with `left`/`top`
// left auto, engines disagree on the static position of an absolutely
// positioned child of a flex container, and WebKit places it far enough
// left for `overflow: hidden` to cut off half the glyph.
left: "0",
top: "0",
position: "absolute", position: "absolute",
WebkitMaskImage: "var(--dbx-completion-icon-mask)", WebkitMaskImage: "var(--dbx-completion-icon-mask)",
WebkitMaskPosition: "center", WebkitMaskPosition: "center",
@@ -1008,7 +1014,7 @@ export function buildSqlCompletionThemeRules(): CodeMirrorStyleSpec {
maskPosition: "center", maskPosition: "center",
maskRepeat: "no-repeat", maskRepeat: "no-repeat",
maskSize: "14px 14px", maskSize: "14px 14px",
width: "14px", width: "15px",
}, },
".cm-completionIcon:after": { ".cm-completionIcon:after": {
content: "'none'", content: "'none'",