Repository navigation
Fix: prevent theme icon crash and escape apostrophes in onclick handl… - #11006
Conversation
|
@Tejaswini-35433 is attempting to deploy a commit to the Dhairya Gothi 's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Thank you for submitting your pull request! 🙌 We'll review it as soon as possible. In the meantime, please ensure that your changes align with our CONTRIBUTING.md. If there are any specific instructions or feedback regarding your PR, we'll provide them here. Thanks again for your contribution! 😊 |
|
hii @dhairyagothi ! , I have successfully edited the code, kindly consider merging this to the main branch, happy to make any relevant changes if needed! |
|
🎉 Your pull request has been successfully merged! 🎉 Thank you for your valuable contribution to our project. Your efforts are greatly appreciated. Feel free to reach out if you have any more contributions or if there's anything else we can assist you with. Keep up the fantastic work! 🚀 |
📝 Pull Request Description
Related Issue
Closes #10694
Summary
Fixes two bugs in the Animated Search Bar's script: a crash when
#themeIcondoesn't exist on the page, and a broken "Search Again"/voice-search button when the query contains an apostrophe.Type of Change
🛠️ Changes Made
themeIcon.textContentassignments inupdateTheme()with a null check (if (themeIcon) { ... }), so the script no longer throwsTypeError: Cannot set properties of nullon pages where#themeIconis absent.onclick="performGoogleSearch('${query}')"pattern for the "Search Again" / voice-search result buttons. The query is now stored safely in adata-queryattribute (escaped viaescapeHtml()), and a properaddEventListener('click', ...)handler reads it and callsperformGoogleSearch(). This avoids breaking out of the inline string when the query contains an apostrophe, since there's no longer an inline JS string to break out of.🧪 Testing and Verification
Local Validation
node scripts/validateProjects.jslocally and it passed with zero errors.Browser Compatibility Check
Responsive & Accessibility Checks
🤝 Contributor Checklist