@@ -295,7 +295,14 @@ function RemoteFunctions(config = {}) {
295295
296296 const parentElement = element . parentElement ;
297297 if ( isElementEditable ( parentElement ) ) {
298- parentElement . click ( ) ;
298+ // Check if parent element has .click() method (HTML elements)
299+ // SVG elements don't have .click() method, so we use _selectElement for them
300+ if ( typeof parentElement . click === 'function' ) {
301+ parentElement . click ( ) ;
302+ } else {
303+ activateHoverLock ( ) ;
304+ _selectElement ( parentElement ) ;
305+ }
299306 } else {
300307 console . error ( "The TagID might be unavailable or the parent element tag is directly body or html" ) ;
301308 }
@@ -3444,6 +3451,22 @@ function RemoteFunctions(config = {}) {
34443451 }
34453452 }
34463453
3454+ /**
3455+ * this function activates hover lock to prevent hover events
3456+ * Used when user performs click actions to avoid UI box conflicts
3457+ */
3458+ function activateHoverLock ( ) {
3459+ if ( _hoverLockTimer ) {
3460+ clearTimeout ( _hoverLockTimer ) ;
3461+ }
3462+
3463+ disableHoverListeners ( ) ;
3464+ _hoverLockTimer = setTimeout ( ( ) => {
3465+ enableHoverListeners ( ) ;
3466+ _hoverLockTimer = null ;
3467+ } , 1500 ) ; // 1.5s
3468+ }
3469+
34473470 /**
34483471 * This function handles the click event on the live preview DOM element
34493472 * this just stops the propagation because otherwise users might not be able to edit buttons or hyperlinks etc
@@ -3456,18 +3479,7 @@ function RemoteFunctions(config = {}) {
34563479 event . preventDefault ( ) ;
34573480 event . stopPropagation ( ) ;
34583481 event . stopImmediatePropagation ( ) ;
3459-
3460- // clear any existing timer before starting new one
3461- if ( _hoverLockTimer ) {
3462- clearTimeout ( _hoverLockTimer ) ;
3463- }
3464-
3465- // disable hover listeners for 2 seconds to prevent info box conflicts
3466- disableHoverListeners ( ) ;
3467- _hoverLockTimer = setTimeout ( ( ) => {
3468- enableHoverListeners ( ) ;
3469- _hoverLockTimer = null ;
3470- } , 1500 ) ;
3482+ activateHoverLock ( ) ;
34713483 }
34723484 }
34733485
0 commit comments