Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 fix(search): close modal when clicking current page result #350

Merged
merged 1 commit into from
Jul 1, 2024

Conversation

welpo
Copy link
Owner

@welpo welpo commented Jul 1, 2024

Summary

This PR fixes an issue where clicking on a search result that leads to the current page didn't close the search modal. The modal now closes correctly when clicking on such results, matching the behavior of hitting enter on a highlighted result.

Related issue

Resolves #348.

Changes

  • Updated the click event listener for search results to check if the clicked link matches the current page URL.
  • Implemented URL normalisation to handle cases with text fragments and trailing slashes.
  • Added checks for Ctrl/Cmd key presses to allow opening results in new tabs without closing the modal.

Accessibility

The changes improve accessibility by ensuring consistent behavior between keyboard navigation (enter key) and mouse clicks for search results leading to the current page.

Type of change

  • Bug fix (fixes an issue without altering functionality)
  • New feature (adds non-breaking functionality)
  • Breaking change (alters existing functionality)
  • UI/UX improvement (enhances user interface without altering functionality)
  • Refactor (improves code quality without altering functionality)
  • Documentation update
  • Other (please describe below)

Checklist

  • I have verified the accessibility of my changes
  • I have tested all possible scenarios for this change
  • I have updated theme.toml with a sane default for the feature
  • I have made corresponding changes to the documentation:
    • Updated config.toml comments
    • Updated theme.toml comments
    • Updated "Mastering tabi" post in English
    • (Optional) Updated "Mastering tabi" post in Spanish
    • (Optional) Updated "Mastering tabi" post in Catalan

@welpo welpo added the bug Something isn't working label Jul 1, 2024
Copy link

netlify bot commented Jul 1, 2024

Deploy Preview for tabi-demo ready!

Name Link
🔨 Latest commit 8cdf19b
🔍 Latest deploy log https://app.netlify.com/sites/tabi-demo/deploys/6683180b8e5cca0008ca6853
😎 Deploy Preview https://deploy-preview-350--tabi-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@welpo welpo merged commit f72f454 into main Jul 1, 2024
6 of 7 checks passed
@welpo welpo deleted the fix/same-page-result-search branch July 1, 2024 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent keyboard and mouse navigation for search
1 participant