You need to be logged in to post in the forum - Log In

An active JCE Pro Subscription is required to post in the forum - Buy a Subscription

Support is currently Offline

Official support hours
Monday to Friday
09:00 - 17:00 Europe/London (BST)

Please create a new Ticket and we will get back to you as soon as we can.

#110783 Div position not resetting after closing pop up

Posted in ‘Mediabox’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Latest post by Cavespider on Friday, 08 April 2022 09:35 BST

Cavespider
I have a series of panels that reveal more info and a read more button which opens the modal window. This all works nice and smoothly, that is until a modal is opened and then closed, the panel with the linked button jumps to the bottom of the contained div.

Hard to explain so if you go to http://dev.s-tax.co.uk/ and scroll down to the panel 'Capital Allowance Questions Answered' and have a play, you will soon see the problem. Please forgive this incomplete page, it is work in progress.

Ryan
When the button is clicked, it gets focus, but when MediaBox is opened, focus shifts to the mediabox popup UI - close, next, previous etc., so when MediaBox is closed, it needs to restore focus to the last focused item, which was the button.

Restoring focus to this button seems to be what makes it display outside of the container, but I'm not sure that this is a MediaBox issue to fix.

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

Cavespider
Fair comment, but I don't need the focus to return to the panel. Normally when the focus is lost from the panel it returns to it's default state with the heading centred in the panel. Instead, when the modal closes the panel goes back to it's default state but with the bottom of panel content showing rather than the top. This only happens when closing a modal, I haven't found another way for this to occur.

Ryan
Restoring focus back to the element that activated the popup is important for accessability and keyboard navigation. This is not something that I will change in MediaBox, but I can provide an option to disable it for each link. Install JCE MediaBox 2.1.3 RC - https://www.joomlacontenteditor.net/downloads/mediabox/development - and then for each popup link, add the attribute data-mediabox-skipfocus="1", eg:

<a href="https://www.joomlacontenteditor.net/index.php/is-there-a-time-limit-to-access-these-capital-allowances" type="text/html" class="btn btn-primary open1 wfpopup" data-mediabox-width="450px" data-mediabox-height="600px" data-mediabox-type="text/html" data-mediabox-skipfocus="1">Read More</a>

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

Cavespider
Thank you, I will check that out.

Appreciated.

Cavespider
Just had a quick try with this and the button does retain the focus after closing the Modal, but I still have the same effect where lower, normally hidden, portion of the panel text is visible.

When the focus switches to the modal the panel returns to it's normal state, on closing the modal the panel contents slide upwards. This is the bit I don't understand.

Ryan
Looking at the page source of your site, you don't appear to have installed JCE MediaBox 2.1.3 RC - https://www.joomlacontenteditor.net/downloads/mediabox/development

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

Cavespider
Well that fixed it. That didn't show in the Joomla extension updates.

Thank you for the time you spent on this, again, really appreciated.

Crispin