Disable WooCommerce autofocus on non-checkout page

When people go to one of my online ordering pages, on load the browser jumps to the bottom of the screen because the quantity field on the last item is in focus. Here are a couple of pages that (should) show the problem:

http://actcatering.com/breakfast
http://actcatering.com/lunch

As far as I can tell, it’s an autofocus issue, but I can’t figure out how to disable it. I’ve seen other people note this kind of issue before, but that was on the checkout form. I’ve tried figuring this out myself substituting what seemed like the right Woo hook, but it’s not solving the problem.

Any ideas?

I may have figured out a non-PHP fix using JS:

var elelist = document.getElementsByTagName(“input”);
for(var i = 0; i < elelist.length; i++){
elelist[i].addEventListener(
“focus”,
function(){this.blur();},
{once: true},
);
}

Seems to only work on the Page JS and not Global JS, but I think that really did solve the problem.

Hello @cheshiredave,

Glad to know that you are were able to fix your issue by yourself.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.