From f55186461c9f4f5578516cc90d0e5ec0830d252b Mon Sep 17 00:00:00 2001 From: Maya Barnes <63436329+mayagbarnes@users.noreply.github.com> Date: Fri, 18 Nov 2022 14:36:54 -0800 Subject: [PATCH] fix: update tooltip positioning for CSP (#714) Co-authored-by: Dominik Moritz --- README.md | 2 +- src/Handler.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f8b4d0f3..235de210 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ vegaEmbed("#vis", spec, {tooltip: {theme: 'dark'}}) .catch(console.error); ``` -If you want to ue a different version of the tooltip handler, you can override the default handler with the handler from Vega Tooltip (and you need to install it separately). +If you want to use a different version of the tooltip handler, you can override the default handler with the handler from Vega Tooltip (and you need to install it separately). ```js var handler = new vegaTooltip.Handler(); diff --git a/src/Handler.ts b/src/Handler.ts index 6bda8722..65be3121 100644 --- a/src/Handler.ts +++ b/src/Handler.ts @@ -86,6 +86,7 @@ export class Handler { this.options.offsetY ); - this.el.setAttribute('style', `top: ${y}px; left: ${x}px`); + this.el.style.top = `${y}px`; + this.el.style.left = `${x}px`; } }