79728278

Date: 2025-08-07 08:30:14
Score: 0.5
Natty:
Report link

I found the answer to my question. I had misunderstood the problem. The issue was not the scrollbar, but how I was computing the size of the inner WebContentsView.

I used getBounds() on the window, but this returns the outer bounds including the window borders, menu etc, whereas the bounds for the web view are expressed relative to the content view.

So the correct code should be

const currentWindow = BaseWindow.getAllWindows()[0];
const web = new WebContentsView({webPreferences: { partition: 'temp-login' }});
currentWindow.contentView.addChildView(web);
web.setBounds({
    x: 0,
    y: 0,
    width: currentWindow.contentView.getBounds().width,
    height: currentWindow.contentView.getBounds().height,
});
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: sam marshall