@devskin/browser-sdk 1.0.23 → 1.0.24

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.
@@ -8929,21 +8929,30 @@ class ScreenshotCollector {
8929
8929
  if (this.config.debug) {
8930
8930
  console.log('[DevSkin] Capturing page screenshot...');
8931
8931
  }
8932
+ // Scroll to top before capturing
8933
+ const originalScrollY = window.scrollY;
8934
+ window.scrollTo(0, 0);
8935
+ // Wait for scroll to complete
8936
+ yield new Promise(resolve => setTimeout(resolve, 100));
8932
8937
  // Get full page dimensions
8933
8938
  const fullWidth = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth, document.body.offsetWidth, document.documentElement.offsetWidth, document.body.clientWidth, document.documentElement.clientWidth);
8934
8939
  const fullHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight);
8935
- const canvas = yield html2canvas(document.body, {
8940
+ const canvas = yield html2canvas(document.documentElement, {
8936
8941
  allowTaint: true,
8937
8942
  useCORS: true,
8938
8943
  logging: false,
8939
8944
  scale: 0.5, // Reduce size
8940
8945
  width: fullWidth,
8941
- height: fullHeight, // Capture ENTIRE page
8946
+ height: fullHeight,
8942
8947
  windowWidth: fullWidth,
8943
8948
  windowHeight: fullHeight,
8949
+ scrollY: 0,
8950
+ scrollX: 0,
8944
8951
  x: 0,
8945
8952
  y: 0,
8946
8953
  });
8954
+ // Restore scroll position
8955
+ window.scrollTo(0, originalScrollY);
8947
8956
  // Convert to base64 JPEG (smaller than PNG)
8948
8957
  const screenshot = canvas.toDataURL('image/jpeg', 0.6);
8949
8958
  // Send to backend