Skip to content

Commit 82bdb6e

Browse files
committed
Improve decoy
1 parent fb0468b commit 82bdb6e

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/lib/decoy.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const DEFAULT_STYLES = {
2020

2121
const STYLES = {
2222
INPUT: { overflow: "hidden", whiteSpace: "nowrap" },
23-
TEXTAREA: { overflowY: "hidden" },
23+
TEXTAREA: { overflow: "hidden" },
2424
SELECT: { overflow: "hidden", whiteSpace: "nowrap" },
2525
OPTION: { overflow: "hidden", whiteSpace: "nowrap" }
2626
};
@@ -39,6 +39,14 @@ class Decoy {
3939
return;
4040
}
4141
const decoy = prepare(dom.clone(underlay, this.elementCache), underlay);
42+
43+
// Specify only absolute side
44+
decoy.style.width = `${underlay.clientWidth}px`;
45+
decoy.style.height = `${underlay.clientHeight}px`;
46+
decoy.style.removeProperty("min-width");
47+
decoy.style.removeProperty("min-height");
48+
decoy.style.removeProperty("max-width");
49+
decoy.style.removeProperty("max-height");
4250
document.body.appendChild(decoy);
4351
decoy.scrollTop = underlay.scrollTop;
4452
decoy.scrollLeft = underlay.scrollLeft;

src/lib/dom.js

-2
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ const clone = (orgElement, baseElement) => {
123123

124124
// Copy all styles
125125
clonedElement.style.cssText = getComputedCssText(orgElement);
126-
clonedElement.scrollTop = orgElement.scrollTop;
127-
clonedElement.scrollLeft = orgElement.scrollLeft;
128126

129127
return clonedElement;
130128
};

0 commit comments

Comments
 (0)