# Zoeken naar tag met selectievakje toont geen resultaten op mobiel

**URL:** https://meta.discourse.org/t/search-for-tag-with-checkbox-not-showing-results-on-mobile/222735
**Category:** Bug
**Tags:** mobile, search
**Created:** [31 maart 2022 om 20:48 UTC](https://meta.discourse.org/t/search-for-tag-with-checkbox-not-showing-results-on-mobile/222735 "2022-03-31T20:48:08Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [31 maart 2022 om 20:48 UTC](https://meta.discourse.org/t/search-for-tag-with-checkbox-not-showing-results-on-mobile/222735/1 "2022-03-31T20:48:08Z")

</div>

> ⚠ **Aug 2023 Note:** The earlier examples in this topic contain references to tags that no longer exist, however the issue with blank results persists.

If I visit [https://meta.discourse.org/tags/c/theme/61/theme-component](https://meta.discourse.org/tags/c/theme/61/theme-component) on moblie, tap the magnifying glass, search e.g. for “topic” and tap the checkbox to “search the tag #Customization > Theme component”, there are two problems.  
On the one hand you need to tap the checkbox twice untill the box is checked. On the other hand there are no search results after tapping the checkbox once or twice, while there are many, if you use the desktop search.

Searching on mobile without touching the checkbox

 ![_20220331_223859](https://global.discourse-cdn.com/meta/original/3X/7/8/78422bf2982fc6090c2706332cd6658870bde1e9.jpeg)  
`https://meta.discourse.org/search?context=tag&context_id=theme-component&q=Topic&skip_context=true`

Searching on mobile & tapped checkbox once

 ![_20220331_223842](https://global.discourse-cdn.com/meta/original/3X/e/e/ee91a9b75aa63e45e4ed03b9835ca71125a84768.jpeg)  
`https://meta.discourse.org/search?context=tag&context_id=theme-component&q=Topic&skip_context=false`

Searching on mobile & tapped checkbox twice

 ![_20220331_222448](https://global.discourse-cdn.com/meta/original/3X/6/3/63778280cb8d2250ceb0500e44b75339bc08d83c.jpeg)  
`https://meta.discourse.org/search?context=tag&context_id=theme-component&q=Topic&skip_context=false`

Searching using desktop-view

 ![_20220331_223513](https://global.discourse-cdn.com/meta/original/3X/f/0/f02cbe04fb29678e3a97f779458aecddf16c1842.jpeg)  
`https://meta.discourse.org/search?q=topic%20%23theme-component`

I know, I could type the #Customization > Theme component into the search to get results on moblie, but I think that’s not the idea of offering the checkbox.

---

<div class="post-metadata">

### Author: ![maiki](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maiki/32/233950_2.png) [@maiki](https://meta.discourse.org/u/maiki)
#### Post date: [1 april 2022 om 01:23 UTC](https://meta.discourse.org/t/search-for-tag-with-checkbox-not-showing-results-on-mobile/222735/2 "2022-04-01T01:23:55Z")

</div>

Hey, good catch @moin. I think you may have found _two_ bugs. 🙂

1. The checkbox doesn’t work immediately, and
2. Scoping search to a tag creates a route that Discourse serves with a 403

## Checkbox isn’t checking

In the mobile the search link adds “context” to the URL, which reveals the checkbox to be toggled in question. In this case, the URL we are looking at is `https://meta.discourse.org/search?context=tag&context_id=theme-component&skip_context=true`.

When we toggle the checkbox, we are changing the search query where `skip_context` changes from `true` to `false` and back again. It also means you may craft a URL where the box is checked by default, such as [https://meta.discourse.org/search?context=category&context\_id=1&skip\_context=false](https://meta.discourse.org/search?context=category&context_id=1&skip_context=false). This is important, because I’ve noticed different behaviour between the two states when they load.

### `skip_context=true`

The default on mobile view, and the box will not be checked. Interacting with the checkbox, with touch or keyboard, changes the URL to `skip_context=false`, but does not check the checkbox. Clicking once more will check it, keeping “false” in the URL.

Afterward it may be toggled back and forth, with corresponding URL changes as expected.

### `skip_context=false`

When the search is loaded the checkbox is checked, and interacting with it works as expected: each interaction changes the checkbox and the URL.

* * *

I’ve noticed separately that using those checkboxes also causes me to lose focus on the page, regardless of the `skip_context` value; hopefully it’s the same thing causing our double-click issue. 🙂

I’ve reproduced this behavior in safe-mode and on mobile devices.

Okay, I’ll see what I can explain about the tags not scoping in a follow up reply, so it’s easier to split off it needed.

---

<div class="post-metadata">

### Author: ![maiki](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maiki/32/233950_2.png) [@maiki](https://meta.discourse.org/u/maiki)
#### Post date: [1 april 2022 om 01:41 UTC](https://meta.discourse.org/t/search-for-tag-with-checkbox-not-showing-results-on-mobile/222735/3 "2022-04-01T01:41:04Z")

</div>

## Scoping of tags in search returns 403

This one threw me off, because when I tried to reproduce it off meta I accidentially loaded a category rather than a tag in the search context. That was fortunate, as when I realized my mistake I at least knew how the search queries are being produced for those contexts.

Using #Customization > Theme and #Customization > Theme component for examples:

When we use the search context for tags our request looks like [https://meta.discourse.org/search?q=topic&page=1&search\_context[type]=tag&search\_context[id]=theme-component](https://meta.discourse.org/search?q=topic&page=1&search_context%5Btype%5D=tag&search_context%5Bid%5D=theme-component), which returns 403.

When we use search context for categories, our request looks like [https://meta.discourse.org/search?q=topic&page=1&search\_context[type]=category&search\_context[id]=61](https://meta.discourse.org/search?q=topic&page=1&search_context%5Btype%5D=category&search_context%5Bid%5D=61), which returns results as expected.

Alternatively, if we choose a tag from the advanced search filters our request looks like [https://meta.discourse.org/search?q=tags:theme-component&page=1](https://meta.discourse.org/search?q=tags:theme-component&page=1) and returns results with that tag.

I’m able to reproduce the `&search_context[type]=tag&search_context[id]=theme-component` path returning a 403 in safe-mode as well.

Are there other `search_context` types? I glanced at the code but wasn’t able to determine; if so, we can test them as well.

---

<div class="post-metadata">

### Author: ![Jonathan5](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jonathan5/32/197134_2.png) [@Jonathan5](https://meta.discourse.org/u/Jonathan5)
#### Post date: [7 augustus 2023 om 17:14 UTC](https://meta.discourse.org/t/search-for-tag-with-checkbox-not-showing-results-on-mobile/222735/4 "2023-08-07T17:14:25Z")

</div>

Continuing the discussion from [Discourse Subscriptions - allow subscription of predetermined length](https://meta.discourse.org/t/discourse-subscriptions-allow-subscription-of-predetermined-length/246395/11):

I was going to link to posts I created with the subscriptions tag, so I went to the tag listing page, and searched from there. No results – see below. When I search from the main page it works all right. It might be the tickbox is the problem, as that is a difference.

 ![IMG_5305](https://global.discourse-cdn.com/meta/original/4X/b/9/f/b9faf9f47cd4f04a5567437ae28efd09323c6b12.png)

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [7 augustus 2023 om 17:23 UTC](https://meta.discourse.org/t/search-for-tag-with-checkbox-not-showing-results-on-mobile/222735/5 "2023-08-07T17:23:39Z")

</div>

I can confirm this. Just tried searching from the #post-voting tag with the option ticked, and it couldn’t find any results (@mention or other regular keyword)

Android/Chrome

~~(not checked desktop yet)~~ I checked on Desktop and it works fine.

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [7 augustus 2023 om 17:58 UTC](https://meta.discourse.org/t/search-for-tag-with-checkbox-not-showing-results-on-mobile/222735/6 "2023-08-07T17:58:08Z")

</div>

Is that one of the issues I reported here?

> [@Search for tag with checkbox not showing results on mobile](https://meta.discourse.org/t/search-for-tag-with-checkbox-on-mobile/222735):
>
> warning Aug 2023 Note: The earlier examples in this topic contain references to tags that no longer exist, however the issue with blank results persists. If I visit [https://meta.discourse.org/tags/c/theme/61/theme-component](https://meta.discourse.org/tags/c/theme/61/theme-component) on moblie, tap the magnifying glass, search e.g. for “topic” and tap the checkbox to “search the tag #theme-component”, there are two problems. On the one hand you need to tap the checkbox twice untill the box is checked. On the other hand there are no search results aft…

---

<div class="post-metadata">

### Author: ![Jonathan5](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jonathan5/32/197134_2.png) [@Jonathan5](https://meta.discourse.org/u/Jonathan5)
#### Post date: [7 augustus 2023 om 18:08 UTC](https://meta.discourse.org/t/search-for-tag-with-checkbox-not-showing-results-on-mobile/222735/7 "2023-08-07T18:08:32Z")

</div>

I didn’t have a problem ticking the box, but the lack of results seems to be the same problem.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [7 augustus 2023 om 19:20 UTC](https://meta.discourse.org/t/search-for-tag-with-checkbox-not-showing-results-on-mobile/222735/8 "2023-08-07T19:20:03Z")

</div>

> [@Moin](#):
>
> Is that one of the issues I reported here?

I have merged the topics. 👍 (and tweaked the OP a tiny bit).

Just to make a note here as well; the example tags in the OP no longer exist, though the issue with the blank search results on mobile they demonstrated still does.

My pretty basic step-by-step:

- On mobile, go to the #post-voting topic list
- Open Search and check the `Search the #post_voting tag` checkbox
- Enter something that would definitely give a hit (eg. ‘comment’ or ‘@JammyDodger’)
- Press ‘Search’

Result: ‘ **No results found** ’

Expected Result: It finds me things

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [7 augustus 2023 om 23:36 UTC](https://meta.discourse.org/t/search-for-tag-with-checkbox-not-showing-results-on-mobile/222735/10 "2023-08-07T23:36:20Z")

</div>

This is indeed a bug, thanks for the report, folks. It should be fixed when this PR is merged: [FIX: Search by tag context was broken by pmusaraj · Pull Request #23006 · discourse/discourse · GitHub](https://github.com/discourse/discourse/pull/23006)

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [11 augustus 2023 om 23:53 UTC](https://meta.discourse.org/t/search-for-tag-with-checkbox-not-showing-results-on-mobile/222735/13 "2023-08-11T23:53:10Z")

</div>

This has now been merged 🥳

[https://github.com/discourse/discourse/pull/23006](https://github.com/discourse/discourse/pull/23006)

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [14 augustus 2023 om 07:00 UTC](https://meta.discourse.org/t/search-for-tag-with-checkbox-not-showing-results-on-mobile/222735/14 "2023-08-14T07:00:01Z")

</div>

This topic was automatically closed after 2 days. New replies are no longer allowed.
