You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Initialize the plugin with separateDialCode enabled.
Place the input field within a hidden container or an iframe during initialization.
Observe that the _getHiddenSelectedCountryWidth function fails to calculate the correct offset width.
Expected Behavior
The _getHiddenSelectedCountryWidth function should correctly calculate the offsetWidth of the selectedCountry element, even when the input is within a hidden container or iframe during initialization.
Actual Behavior
The _getHiddenSelectedCountryWidth function fails when the input is within an iframe or hidden container. This is likely because the document.body.appendChild(containerClone) operation does not correctly account for the DOM context, causing the width calculation to return incorrect or zero values.
Proposed Solution
The issue can be resolved by ensuring that the operation to append the containerClone occurs in the correct DOM context. For example, using window.top.document.body.appendChild(containerClone) ensures that the correct body element is targeted, even within an iframe.
Plugin Version
v25.2.1
Steps to Reproduce
separateDialCode
enabled._getHiddenSelectedCountryWidth
function fails to calculate the correct offset width.Expected Behavior
The
_getHiddenSelectedCountryWidth
function should correctly calculate theoffsetWidth
of theselectedCountry
element, even when the input is within a hidden container or iframe during initialization.Actual Behavior
The
_getHiddenSelectedCountryWidth
function fails when the input is within an iframe or hidden container. This is likely because thedocument.body.appendChild(containerClone)
operation does not correctly account for the DOM context, causing the width calculation to return incorrect or zero values.Proposed Solution
The issue can be resolved by ensuring that the operation to append the containerClone occurs in the correct DOM context. For example, using
window.top.document.body.appendChild(containerClone)
ensures that the correct body element is targeted, even within an iframe.See PR: #1934
Additional Notes
The text was updated successfully, but these errors were encountered: