Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Merge requests
  • !27710

Update DocSearch.js to latest version

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/algolia/docs/docsearch-update into v4-dev Nov 22, 2018
  • Overview 0
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: pixelastic

The latest (2.6.2) docsearch.js version now displays results as standard <a href> links, allowing users to ctrl-click on them to trigger default browser behavior of opening in a new tab. This has been a been a long awaited feature and is now live.

To maintain backward compatibility, this behavior has only been enabled to users that didn't define their own handleSelected method. Because the Bootstrap documentation uses its own handleSelected, you won't be able to ctrl-clicks results as of today :/

This PR updates your docsearch() code to take advantage of the new <a href> template, by removing your custom handleSelected and moving its behavior to the transformData call. Namely, what you wanted to avoid was jumping to the first <h1> of the pages (source), which would prevent users from seeing the header. This PR checks if the suggestion targets the #content anchor (meaning it goes to this first <h1>) and if so, removes it.

Behavior should be the same, but at least now you can enjoy the ctrl-click :)

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/algolia/docs/docsearch-update