[suggestion] observe when SHIFT or CTRL (or command) keys are presed
-
I hold the CTRL and SHIFT keys a lot when navigating sites to pop a new tab or window. I would like to suggest that when these keys are pressed that your plugin ignores the click. This would allow for normal navigation to have the effects and for new tabs and windows to be opened ??
Here is a script I use for something else which handles this behavior:
<script> document.addEventListener('click', function(event) { // Bail if the click originated from an actual link inside the hot cover if (event.target.closest('a')) return; // Find the closest ancestor with both 'wp-block-cover' and 'hot' classes const hotCover = event.target.closest('.wp-block-cover.hot'); if (hotCover) { const link = hotCover.querySelector('a'); if (link && link.href) { // Check for modifier keys (CTRL or CMD for opening in a new tab) if (event.ctrlKey || event.metaKey) { window.open(link.href, '_blank'); } else { link.click(); } } } }); </script>
Thanks!
- You must be logged in to reply to this topic.