From cb2dbcbb19e8f2e7d974597a1a17bb59f13d3406 Mon Sep 17 00:00:00 2001 From: j-mendez Date: Fri, 9 Feb 2024 11:13:40 -0500 Subject: [PATCH] chore(kayle): fix clip bounding box element handling --- kayle/lib/index.ts | 9 ++++++++- kayle/lib/runner.ts | 7 +++++-- kayle/package.json | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/kayle/lib/index.ts b/kayle/lib/index.ts index b68f168..2cd2ca2 100644 --- a/kayle/lib/index.ts +++ b/kayle/lib/index.ts @@ -11,5 +11,12 @@ export { sendCDPPageConfigurationEnable, sendCDPPageConfigurationReset, } from "./utils/cdp-blocking"; -export { setLogging, Standard, type RunnerConfig, type Runner, type LifeCycleEvent, type WaitForOptions } from "./config"; +export { + setLogging, + Standard, + type RunnerConfig, + type Runner, + type LifeCycleEvent, + type WaitForOptions, +} from "./config"; export { extractLinks, innateBuilder } from "./wasm"; diff --git a/kayle/lib/runner.ts b/kayle/lib/runner.ts index 8e3199b..5e910ad 100644 --- a/kayle/lib/runner.ts +++ b/kayle/lib/runner.ts @@ -48,7 +48,7 @@ [A_5, [20, H_5]], [H_5, [20, A_5]], [A_6, [10, H_6]], - [H_6, [10, A_6]] + [H_6, [10, A_6]], ]); // root html element @@ -65,7 +65,10 @@ if (issue.element) { context = getElementContext(issue.element); selector = getElementSelector(issue.element); - if (cliped) { + if ( + cliped && + typeof issue.element.getBoundingClientRect === "function" + ) { const { x, y, width, height } = issue.element.getBoundingClientRect(); clip = { diff --git a/kayle/package.json b/kayle/package.json index ae22fef..e8c306f 100644 --- a/kayle/package.json +++ b/kayle/package.json @@ -1,6 +1,6 @@ { "name": "kayle", - "version": "0.8.8", + "version": "0.8.9", "description": "Extremely fast and accurate accessibility engine built for any headless tool like playwright or puppeteer.", "main": "./build/index.js", "keywords": [