Magento – How to i scroll up error message after click on place order magento2

authorize.netcheckout-pageerrormagento2place-order

If a user is a small screen device, there are many situations where they will never see an error message.

I referred this link
Usability issues with error/notice/success messages. But do not get any answer

For example,

  1. if they're on the "Shipping" step of the checkout process and an
    error message is added, they may not see the error message get added
    to the top of the page.
  2. My suggestion would be to either smooth scroll the user up to the
    error message, display the error message next to the button.

enter image description here

Best Answer

A possible quick solution could be using high-level programming languages like Javascript.

Just check if the error div has value in it using selector in jQuery/Javascript, and then add a jQuery script to scroll to top:

$(window).scrollTop(0);

You could also add smooth effect if you wish to.

Related Topic