Skip to content

Commit

Permalink
Update script.js
Browse files Browse the repository at this point in the history
searchInput focus for radio button div click too
  • Loading branch information
prem-k-r authored Jan 18, 2025
1 parent 2aef76a commit 7137bdd
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions scripts/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -1258,7 +1258,7 @@ document.addEventListener("DOMContentLoaded", () => {
// get the parent
const parent = sortedDropdowns[0]?.parentNode;

// Append the items. if parent exists.
// Append the items if parent exists.
if (parent) {
sortedDropdowns.forEach(item => parent.appendChild(item));
}
Expand All @@ -1273,7 +1273,7 @@ document.addEventListener("DOMContentLoaded", () => {

radioButton.checked = true;

// Swap The dropdown. and sort them
// Swap the dropdown and sort them
swapDropdown(selector);
sortDropdown()

Expand All @@ -1283,7 +1283,8 @@ document.addEventListener("DOMContentLoaded", () => {

// Make entire search-engine div clickable
document.querySelectorAll(".search-engine").forEach((engineDiv) => {
engineDiv.addEventListener("click", () => {
engineDiv.addEventListener("click", (event) => {
event.stopPropagation();
const radioButton = engineDiv.querySelector('input[type="radio"]');

radioButton.checked = true;
Expand All @@ -1292,11 +1293,15 @@ document.addEventListener("DOMContentLoaded", () => {

const selector = `[data-engine="${radioButtonValue}"]`;

// Swap The dropdown.
// Swap the dropdown
swapDropdown(selector);
sortDropdown()
sortDropdown();

localStorage.setItem("selectedSearchEngine", radioButton.value);

const searchBar = document.querySelector(".searchbar");
searchInput.focus();
searchBar.classList.add("active");
});
});

Expand Down

0 comments on commit 7137bdd

Please sign in to comment.