processwire-issues icon indicating copy to clipboard operation
processwire-issues copied to clipboard

Uncaught TypeError: can't access property "closest", sidebarSearchInput is null

Open adrianbj opened this issue 3 months ago • 6 comments

I am seeing this in Zen browser (Firefox engine). It doesn't happen all the time, so it's related to delays preventing the element from being available in time.

It's coming from this line:

const sidebarSearchForm = sidebarSearchInput.closest(".pw-search-form");

adrianbj avatar Sep 09 '25 23:09 adrianbj

@adrianbj I ran a global search on the entire PW codebase, but can't find reference to sidebarSearchForm or sidebarSearchInput. What is the source of that code?

ryancramerdesign avatar Sep 18 '25 14:09 ryancramerdesign

@ryancramerdesign - it's here: https://github.com/processwire/processwire/blob/ec70c460fd57e82328f75064fa228d30765a18a1/wire/modules/AdminTheme/AdminThemeUikit/themes/default/admin.js#L11

adrianbj avatar Sep 18 '25 15:09 adrianbj

@ryancramerdesign - this is actually critical because when that error shows up, it blocks other JS interactions. For example, if it's on the Page Edit interface, all the tabs are broken.

adrianbj avatar Sep 23 '25 22:09 adrianbj

If it helps, I mostly see this with Zen browser (Firefox based) - happens almost all the time.

adrianbj avatar Sep 25 '25 12:09 adrianbj

@adrianbj, can you explain in more details how to replicate? I'm using Firefox, not Zen browser if that matters?

matjazpotocnik avatar Sep 25 '25 16:09 matjazpotocnik

@matjazpotocnik - it happens almost all the time when I edit a page with Zen. It doesn't seem to happen with FF for me but Zen is otherwise non-problematic for me as a daily browser so I do think something could be improved here.

adrianbj avatar Oct 06 '25 23:10 adrianbj