Changeset 3365959
- Timestamp:
- 09/22/2025 04:52:53 PM (6 months ago)
- Location:
- printess-editor/trunk
- Files:
-
- 3 edited
-
includes/js/printessWoocommerce.js (modified) (8 diffs)
-
printess.php (modified) (3 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
printess-editor/trunk/includes/js/printessWoocommerce.js
r3364022 r3365959 1 function trapFocus(root) { 1 const printessFocusListeners = []; 2 const printessTrapFocus = function (root) { 2 3 const keyboardFocusableElements = root?.querySelectorAll('a[href], button, input, textarea, select, details, [tabindex]'); 3 4 if (keyboardFocusableElements && keyboardFocusableElements.length > 0) { 4 5 const lastFocusableElement = keyboardFocusableElements[keyboardFocusableElements.length - 1]; 5 6 const firstFocusableElement = keyboardFocusableElements[0]; 6 firstFocusableElement?.addEventListener("keydown", (e) => {7 if ( e.key === "Tab" && e.shiftKey && lastFocusableElement) {8 e.preventDefault();7 const tabBackToLast = (keyEvent) => { 8 if (keyEvent.key === "Tab" && keyEvent.shiftKey && lastFocusableElement) { 9 keyEvent.preventDefault(); 9 10 lastFocusableElement.focus(); 10 11 } 11 } );12 lastFocusableElement?.addEventListener("keydown", (e) => {13 if ( e.key === "Tab" && !e.shiftKey && firstFocusableElement) {14 e.preventDefault();12 }; 13 const tabToFirst = (keyEvent) => { 14 if (keyEvent.key === "Tab" && !keyEvent.shiftKey && firstFocusableElement) { 15 keyEvent.preventDefault(); 15 16 firstFocusableElement.focus(); 16 17 } 17 }); 18 }; 19 printessFocusListeners.push(new AbortController); 20 firstFocusableElement?.addEventListener("keydown", tabBackToLast, { signal: printessFocusListeners[printessFocusListeners.length - 1].signal }); 21 lastFocusableElement?.addEventListener("keydown", tabToFirst, { signal: printessFocusListeners[printessFocusListeners.length - 1].signal }); 18 22 firstFocusableElement?.focus(); 19 23 } 20 } 24 }; 25 const printessFreeFocus = function () { 26 if (printessFocusListeners.length > 0) { 27 printessFocusListeners[printessFocusListeners.length - 1].abort(); 28 printessFocusListeners.pop(); 29 } 30 }; 21 31 const initPrintessWCEditor = function (printessSettings) { 22 32 const CART_FORM_SELECTOR = "form.cart"; … … 174 184 if (dialog) { 175 185 dialog.classList.remove("visible"); 186 printessFreeFocus(); 176 187 } 177 188 }; … … 292 303 cancelButton.addEventListener("click", internalCancelCallback); 293 304 } 294 cancelButton.style.backgroundColor = "red"; 295 trapFocus(dialog); 305 printessTrapFocus(dialog); 296 306 }; 297 307 const postMessage = (cmd, properties) => { … … 319 329 } 320 330 } 321 trapFocus(overlay);331 printessTrapFocus(overlay); 322 332 }; 323 333 const hideInformationOverlay = () => { … … 325 335 if (overlay) { 326 336 overlay.classList.remove("visible"); 337 printessFreeFocus(); 327 338 } 328 339 }; … … 934 945 }; 935 946 const loginCallback = (designName) => { 936 if (!loginAndSave(designName, settings.product.id, variant ? variant.id : null, saveToken, thumbnailUrl, productValues)) {947 if (!loginAndSave(designName, settings.product.id, variant ? variant.id : null, saveToken, thumbnailUrl, getCurrentProductOptionValues(settings.product, false))) { 937 948 alert(printessSettings.userMessages && printessSettings.userMessages["noDisplayName"] ? printessSettings.userMessages["noDisplayName"] : 'Please provide a display name.'); 938 949 showSaveDialog(designName, printessSettings.userIsLoggedIn ? saveDesignCallback : loginCallback, cancelCallback); … … 1288 1299 dlg.removeEventListener("keyup", keyUpHandler); 1289 1300 dlg.removeEventListener("keydown", keyDownHandler); 1301 printessFreeFocus(); 1290 1302 } 1291 1303 if (previouslyFocused && previouslyFocused instanceof HTMLElement) { … … 1323 1335 dlg.addEventListener("keydown", keyDownHandler); 1324 1336 } 1325 trapFocus(dlg);1337 printessTrapFocus(dlg); 1326 1338 } 1327 1339 function printessRegisterCheckoutFilters(registerCheckoutFilters) { -
printess-editor/trunk/printess.php
r3364556 r3365959 5 5 * Plugin URI: https://printess.com/kb/integrations/woo-commerce/index.html 6 6 * Developer: Bastian Kröger (support@printess.com); Alexander Oser (support@printess.com) 7 * Version: 1.6.6 47 * Version: 1.6.65 8 8 * Author: Printess 9 9 * Author URI: https://printess.com … … 14 14 * Tested up to: 6.8 15 15 * 16 * Woo: 10000:92402 2dfsfhsf8429842386wdff234sfd16 * Woo: 10000:924023dfsfhsf8429842386wdff234sfd 17 17 * WC requires at least: 5.8 18 18 * WC tested up to: 9.8.2 … … 3290 3290 $token = printess_get_value_from_array( $_GET, 'token' ); 3291 3291 $display_name = printess_get_value_from_array( $_GET, 'displayName' ); 3292 $options = printess_get_value_from_array( $_GET, 'options' ); 3292 3293 $user_id = null; 3293 3294 -
printess-editor/trunk/readme.txt
r3364556 r3365959 338 338 = 1.6.64 = 339 339 - Fixed improper handling of cart item sorting for some users that have cart items that are not printess cart items and have object type cart items instead of array type cart items 340 341 = 1.6.65 = 342 - Fixed: Fixed bug that saved a wrong variant in case the current user is not logged in and clicks on save. Before, the default variant was used instead of the current selected variant.
Note: See TracChangeset
for help on using the changeset viewer.