Stop mx-focus being applied on page load.

1
Hi, when a Mendix page is loaded it appears that the ‘mx-focus’ class is applied to the first input in the tab-index, whether that be a button or input.  This causes the page to automatically scroll down to that position on page load, which is not the expected behaviour. For example if a page is made up mainly of text with a ‘next’ button at the bottom, our pages are currently scrolling directly to the bottom when loaded, when ‘mx-focus’ is applied to that button.  I can ‘fix’ this by giving each of the inputs a tab-index of -1, however this then causes accessibility issues for keyboard users.    Any advice on a solution would be appreciated. Thanks Patrick .  
asked
3 answers
1

Hi there,

I’ve had this issue numerous times.  I put a javascript snippet widget on the page and use this:

window.onbeforeunload = function () {
  window.scrollTo(0, 0);
}

I hope that helps!

Thnx,

Jonathan

answered
1

Workaround: A dummy button or input at the top of the page.

answered
0

Workaround: Just place HTML/ JavaScript Snippet at the top of the page.

answered