const documentWidth = document.documentElement.offsetWidth;
document.querySelectorAll("*").forEach((node) => {
if (node.offsetWidth > documentWidth) {
console.log(node);
}
});
Reference: Quickly Find the Element That Is Causing Horizontal Scrolling