Menu icon Foundation
Multiple Reveal buttons causing page 'jump' on close

I have two buttons, one at the top of the page, and one at the bottom.

They both open the same reveal window.

If I click the top button, and then close the reveal window... the viewport jumps to the bottom of the page and applies focus to the bottom (last) button.

I've played around with preventDefault() etc, and removing :focus styling but the problem persists.

Is there a way to prevent this?

revealclosemodal

I have two buttons, one at the top of the page, and one at the bottom.

They both open the same reveal window.

If I click the top button, and then close the reveal window... the viewport jumps to the bottom of the page and applies focus to the bottom (last) button.

I've played around with preventDefault() etc, and removing :focus styling but the problem persists.

Is there a way to prevent this?

Kyle Kerley almost 2 years ago

I'm having the exact same issue right now and can't seem to figure out how to stop it from happening. It's like the reverse of clicking a link with href="#"