Popup-Maker
Popup-Maker copied to clipboard
Make popup settings vertical tabs "sticky"
Describe the feature request
Right now, the Triggers tab is the default active tab after every page load even if I'm actively on the Targeting, Display, Close, or Advanced tabs.
Use case
It'd be super nice to have Popup Maker remember the active tab so I can verify my settings changes look good without having to manually go back where I was just before saving or reloading the page.
Example screenshots (if any)
Screencast: https://share.wppopupmaker.com/9ZuQ52wL
The demo is a proof of concept written mostly in plain JavaScript using the browser session storage API. I can port it to jQuery for my next sprint.
In a future sprint, we can add support for the horizontal tabs.
@marklchaves I don't know how many times I've thought of doing this, but was in the middle of something else already. YES!!, it needs to work like that.
@danieliser sounds good! I've got the horizontal tabs working in my dev. I'll jump back on this shortly to port to jQuery and keep you posted 😌
Also post your vanilla JS here before you rewrite. We are slowly moving away from jQuery.
Instructions for installing the sticky tab code
- Go to the branch https://github.com/PopupMaker/Popup-Maker/tree/975-popup-settings-sticky-vertical-horizontal-tabs
- Copy assets/js/sticky-module.js to your test env
- Edit your test env's assets/js/admin-popup-editor.js
- Insert
import { makeTabsSticky } from "./sticky-module.js";
at the top of theadmin-popup-editor.js
file - Insert
makeTabsSticky();
right after line 297 inadmin-popup-editor.js
- Minify
admin-popup-editor.js
- Add the PHP filter hook below to your chile theme
functions.php
or use a code snippets plugin.
function add_type_attribute($tag, $handle, $src) {
if ( 'pum-admin-popup-editor' !== $handle ) {
return $tag;
}
// Add the original ID and the type attributes.
$tag = '<script id="pum-admin-popup-editor-js" type="module" src="' . esc_url( $src ) . '"></script>';
return $tag;
}
add_filter('script_loader_tag', 'add_type_attribute' , 10, 3);