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

[BUG] Images cannot be clicked anymore #3003

Closed
WreckingBANG opened this issue Nov 13, 2023 · 11 comments · Fixed by #3006
Closed

[BUG] Images cannot be clicked anymore #3003

WreckingBANG opened this issue Nov 13, 2023 · 11 comments · Fixed by #3006
Labels
help wanted Extra attention is needed

Comments

@WreckingBANG
Copy link

WreckingBANG commented Nov 13, 2023

Version of SearXNG, commit number if you are using on master branch and stipulate if you forked SearXNG
2023.11.12-6368f845c

How did you install SearXNG?
docker-compose

What happened?
When i click on any image from any search engine, there should appear a section showing the image in a bigger size with the options to open the website it is from and other option. This section is not appearing anymore.

How To Reproduce

  1. Search Anything
  2. Click on any Image
  3. Nothing happens (No section is opening)

Expected behavior
There should appear a section showing the image in a bigger size with the options to open the website it is from and other option.

Screenshots & Logs
@@
Screenshot from 2023-11-13 21-29-54
I marked the Section that is now missing red

Additional context
I tested it on my own private instance as well as on https://search.inetol.net . Both instances showed the same behaviour.
I tested it on Chromium and Firefox .
I tested it on Mobile (Android) and Desktop (Linux).
I tried clearing my Browser Cache.
It seems to be since 2023.11.11-7b1951aa9

@WreckingBANG WreckingBANG added the bug Something isn't working label Nov 13, 2023
@WreckingBANG WreckingBANG changed the title Images cannot be clicked anymore [BUG] Images cannot be clicked anymore Nov 13, 2023
@return42
Copy link
Member

Not sure but it seems the JS is broken on https://search.inetol.net

grafik

I tested with 2023.11.12+76b91a3ef (current master) and it works and I tested some instances from searx.space and version 2023.11.11 .. no issues.

Did you customized CSS or JS?

@return42 return42 added help wanted Extra attention is needed and removed bug Something isn't working labels Nov 13, 2023
@unixfox
Copy link
Member

unixfox commented Nov 13, 2023

Can't replicate either on https://paulgo.io/

On searx.space, for search.inetol.net it says the instance is customized.

image

@WreckingBANG
Copy link
Author

I did not customize my css, i will check for errors on my instance tomorrow

@WreckingBANG2
Copy link

https://search.sapti.me does not use custom css and has the same error.
grafik

@return42
Copy link
Member

return42 commented Nov 14, 2023

I guess the initialization fails due to this exception, when the page is loaded.

grafik

This line raises the error ..

d.querySelector('#search_url button#copy_url').style.display = "block";

But I do not understand why / and why it works in current master but not on some of the instances.

@BernieHuang2008
Copy link
Contributor

According to the error message, it seems that the script is loaded before HTML, but I'm not sure, and this can't explain why it failed sometimes.

@return42
Copy link
Member

According to the error message, it seems that the script is loaded before HTML, but I'm not sure, and this can't explain why it failed sometimes.

The HTML loads the CSS and then JS .. but for some reasons the instances with this issue miss the button in the sidebar:

image

<button id="copy_url" type="submit" data-copied-text="{{ _('Copied') }}">{{ _('Copy') }}</button>

image

Aah .. here is the reason .. URL is only shown in HTTP POST request:

{%- if method == 'POST' -%}
{%- include 'simple/elements/search_url.html' -%}
{%- endif -%}

When set to GET ..

method: "POST"

there is no URL in the sidebar!
@BernieHuang2008 can you please fix it (here):

d.querySelector('#search_url button#copy_url').style.display = "block";

@extremelyonline
Copy link

Hello, I encountered a similar issue but only on the mobile site. In my testing, the image click doens't work on:

priv.au
search.inetol.net
paulgo.io 
opnxng.com

However, it works on:

331221.xyz
searx.be

I did my testing on Android Cromite, with ad block and incognito mode disabled.

@BernieHuang2008
Copy link
Contributor

@return42

I apologize for my mistake, now it's solved in #3006, please have a look ~

@return42
Copy link
Member

I apologize for my mistake,

no need to apologize .. its a complex thing .. don't ask how many mistakes I do every day ;)

return42 pushed a commit to BernieHuang2008/searxng that referenced this issue Nov 14, 2023
URL in sidedbar only exists in HTTP POST requests.  On HTTP GET requests the
selector ``#search_url button#copy_url`` results in a ``null`` type and a
``.style.display`` raises::

   Uncaught TypeError: d.querySelector(...) is null

As a result, the initialization of the event handler is no longer carried out.

Closes: searxng#3003
Suggested-by: Markus Heiser <markus.heiser@darmarit.de>
@WreckingBANG
Copy link
Author

Thank you for fixing it that quickly!👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants