{
let currentElement = $store.desktopSearchInput.inputField;
let isDesktopVisible = true;
while (currentElement) {
const style = window.getComputedStyle(currentElement);
// Check if the current element is not visible
if (style.display === 'none' || style.visibility === 'hidden') {
isDesktopVisible = false;
}
currentElement = currentElement.parentElement; // Move up to the parent
}
const inputField = isDesktopVisible ? $store.desktopSearchInput.inputField : $store.mobileSearchInput.inputField;
// Check if inputField is in the DOM and callable
if (inputField && inputField instanceof HTMLInputElement) {
inputField.focus(); // Call focus on the input element
console.log('Focused on inputField:', inputField);
} else {
console.error('inputField is not a valid HTMLInputElement or is undefined');
}
});
console.log('done with clickedMenuSearch');
">
Search
Account
Sign In/Sign Up, Track Your Order, Rewards & Subscriptions