Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

fix(chrome-ext): address scrolling problems (#1485)

Elijah Potter1d6851eca5df
diff --git a/packages/chrome-plugin/src/TextFieldRange.ts b/packages/chrome-plugin/src/TextFieldRange.ts
index 154f6fc2b..55cbfad85 100644
--- a/packages/chrome-plugin/src/TextFieldRange.ts
+++ b/packages/chrome-plugin/src/TextFieldRange.ts
@@ -57,6 +57,8 @@ export default class TextFieldRange {
'borderBottomWidth',
'borderLeftWidth',
'boxSizing',
+ 'overflowX',
+ 'overflowY',
];
propertiesToCopy.forEach((prop) => {
this.mirror!.style[prop] = computed[prop];
diff --git a/packages/chrome-plugin/tests/github.spec.ts b/packages/chrome-plugin/tests/github.spec.ts
index b9931042f..cf6d71939 100644
--- a/packages/chrome-plugin/tests/github.spec.ts
+++ b/packages/chrome-plugin/tests/github.spec.ts
@@ -61,6 +61,20 @@ test('Wraps correctly', async ({ page }) => {
]);
});
+test('Scrolls correctly', async ({ page }) => {
+ await page.goto(TEST_PAGE_URL);
+
+ const editor = getTextarea(page);
+ await replaceEditorContent(
+ editor,
+ 'This is a test of the the Harper grammar checker, specifically if \n\n\n\n\n\n\n\n\n\n\n\n\nit scrolls beyo nd the height of the buffer.',
+ );
+
+ await page.waitForTimeout(6000);
+
+ await assertHarperHighlightBoxes(page, [{ width: 58.828125, x: 117.40625, y: 161, height: 18 }]);
+});
+
async function assertHarperHighlightBoxes(page: Page, boxes: Box[]): Promise<void> {
const highlights = getHarperHighlights(page);