From 38b8dce6f5e6dc63c38aa34905b21dc1ab832c33 Mon Sep 17 00:00:00 2001 From: helenasabel <helena.b.sabel@gmail.com> Date: Thu, 2 May 2024 14:45:18 +0200 Subject: [PATCH 1/2] feat: changes vertical alignment of scroll --- src/pb-highlight.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pb-highlight.js b/src/pb-highlight.js index c3b02209..325f3757 100644 --- a/src/pb-highlight.js +++ b/src/pb-highlight.js @@ -134,7 +134,7 @@ export class PbHighlight extends pbMixin(LitElement) { if (ev.detail.source != this && ev.detail.id === this.key) { this._className = 'highlight-on'; if (ev.detail.scroll) { - this.scrollIntoView({ behaviour: 'smooth' }); + this.scrollIntoView({ block: "center", behaviour: 'smooth' }); } if (this.duration > 0) { setTimeout(function () { From dfe188178d556608501a5e600ccb81591565e6c2 Mon Sep 17 00:00:00 2001 From: helenasabel <helena.b.sabel@gmail.com> Date: Thu, 2 May 2024 14:46:23 +0200 Subject: [PATCH 2/2] fix: no scrolling when component is disabled --- src/pb-highlight.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pb-highlight.js b/src/pb-highlight.js index 325f3757..b20e5787 100644 --- a/src/pb-highlight.js +++ b/src/pb-highlight.js @@ -133,7 +133,7 @@ export class PbHighlight extends pbMixin(LitElement) { _highlightOn(ev) { if (ev.detail.source != this && ev.detail.id === this.key) { this._className = 'highlight-on'; - if (ev.detail.scroll) { + if (ev.detail.scroll && this.disabled == false) { this.scrollIntoView({ block: "center", behaviour: 'smooth' }); } if (this.duration > 0) {