Search should lead to hit's Section #3816

Open
opened 2026-02-05 07:33:32 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @majortomL on GitHub (May 24, 2023).

Describe the Bug

When searching content in BookStack, clicking a search result does not forward to the section of the page the hit is on, but only opens the page scrolled to the top.

Steps to Reproduce

  1. Search anything
  2. Click any result whose hit is some scrolls down the respective page

Expected Behaviour

Page with search hit opens up and then scrolls down to the section where the hit is.

Screenshots or Additional Context

No response

Browser Details

Edge

Exact BookStack Version

v23.02.1

PHP Version

No response

Hosting Environment

Windows hosted

Originally created by @majortomL on GitHub (May 24, 2023). ### Describe the Bug When searching content in BookStack, clicking a search result does not forward to the section of the page the hit is on, but only opens the page scrolled to the top. ### Steps to Reproduce 1. Search anything 2. Click any result whose hit is some scrolls down the respective page ### Expected Behaviour Page with search hit opens up and then scrolls down to the section where the hit is. ### Screenshots or Additional Context _No response_ ### Browser Details Edge ### Exact BookStack Version v23.02.1 ### PHP Version _No response_ ### Hosting Environment Windows hosted
OVERLORD added the 🐛 Bug label 2026-02-05 07:33:32 +03:00
Author
Owner

@ssddanbrown commented on GitHub (May 26, 2023):

I swear this was an open issue before, but I can't find anything similar.
Also had it in mind we supported this at one stage but can't find any evidence, even when looking back at some old versions.
Since I can't find evidence of this ever being supported before, I'll update this to a feature request since it's not a bug in existing supported logic.

We won't be (easily) able to take the user to the exact first highlighted hit shown in the results list, at least without a bunch more processing, but we can pass any normal search terms used and perform a rough similar match upon view which should meet most cases.

I was thinking we could use browser text fragments for this but support remains patchy so it's probably best to use a custom solution for now (Pass normal query param then pick that up on view side). We do already have some jump-to-text functionality on the view side, can't remember the use case of that.

@ssddanbrown commented on GitHub (May 26, 2023): I swear this was an open issue before, but I can't find anything similar. Also had it in mind we supported this at one stage but can't find any evidence, even when looking back at some old versions. Since I can't find evidence of this ever being supported before, I'll update this to a feature request since it's not a bug in existing supported logic. We won't be (easily) able to take the user to the exact first highlighted hit shown in the results list, at least without a bunch more processing, but we can pass any normal search terms used and perform a rough similar match upon view which should meet most cases. I was thinking we could use [browser text fragments for this](https://developer.mozilla.org/en-US/docs/Web/Text_fragments) but support remains patchy so it's probably best to use a custom solution for now (Pass normal query param then pick that up on view side). We do already have some [jump-to-text](https://github.com/BookStackApp/BookStack/blob/da3ae3ba8b47800058f8613b2608a4084d64eb43/resources/js/components/page-display.js#L45) functionality on the view side, can't remember the use case of that.
Author
Owner

@adamreading commented on GitHub (Oct 11, 2023):

It would also be amazing if the search terms were Highlighted in page once clicked on - in the same way as when using the CTRL-F style browser search. At the moment we tell users to use Global Search to find the page - and then research using CTRL-F once on the page to highlight the text

@adamreading commented on GitHub (Oct 11, 2023): It would also be amazing if the search terms were Highlighted in page once clicked on - in the same way as when using the CTRL-F style browser search. At the moment we tell users to use Global Search to find the page - and then research using CTRL-F once on the page to highlight the text
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#3816