@hashrytech/quick-components-kit 0.16.6 → 0.16.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @hashrytech/quick-components-kit
2
2
 
3
+ ## 0.16.7
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: reverting last change and remove smooth scroll to get back to original position for disable scroll
8
+
3
9
  ## 0.16.6
4
10
 
5
11
  ### Patch Changes
@@ -13,9 +13,12 @@ export function disableScroll(node, enabled = true) {
13
13
  const originalBodyWidth = document.body.style.width;
14
14
  const originalTop = document.body.style.top;
15
15
  const originalOverflow = document.documentElement.style.overflowY;
16
+ const hasVerticalScrollbar = document.documentElement.scrollHeight > document.documentElement.clientHeight;
16
17
  function applyLock() {
17
18
  document.body.style.top = `-${scrollTop}px`;
18
- document.documentElement.style.overflowY = 'scroll';
19
+ if (hasVerticalScrollbar) {
20
+ document.documentElement.style.overflowY = 'scroll'; // ensure layout doesn't shift
21
+ }
19
22
  document.body.style.position = 'fixed';
20
23
  document.body.style.width = '100%';
21
24
  }
@@ -24,7 +27,8 @@ export function disableScroll(node, enabled = true) {
24
27
  document.body.style.width = originalBodyWidth;
25
28
  document.body.style.top = originalTop;
26
29
  document.documentElement.style.overflowY = originalOverflow;
27
- window.scrollTo(0, scrollTop);
30
+ // Instantly restore scroll position without animation
31
+ window.scrollTo({ top: scrollTop, behavior: 'auto' });
28
32
  }
29
33
  if (node && enabled)
30
34
  applyLock();
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/hashrytech/quick-components-kit.git"
7
7
  },
8
- "version": "0.16.6",
8
+ "version": "0.16.7",
9
9
  "license": "MIT",
10
10
  "author": "Hashry Tech",
11
11
  "files": [