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

Fix search not working on mobile because of undefined ref #6706

Open
wants to merge 2 commits into
base: development
Choose a base branch
from

Conversation

MarmadileManteater
Copy link
Contributor

@MarmadileManteater MarmadileManteater commented Feb 1, 2025

Fix search not working on mobile because of undefined ref

Pull Request Type

  • Bugfix
  • Feature Implementation
  • Documentation
  • Other

Description

I noticed that there was an error happening on mobile when trying to search.
vue.runtime.esm.js:3106 TypeError: Cannot read properties of undefined (reading 'blur')
The line that traces back to is here:

this.$refs.searchContainer.blur()

Looking into the component's template, I couldn't find a ref that matched it. Looking at the history, it looks like at one point the ref was on this element with the searchContainer class.

8e72e7f#diff-07257d469f27c18e3d2c97c8c867fe787ee304ee7fbb6a3daffb80600a8183f9R71

This PR adds back this ref="searchContainer" to prevent that error and fix the search on mobile.

Testing

  1. Shrink the window down to small enough that the search bar is hidden (width<=680px)
  2. Attempt to search

Desktop

  • OS: LMDE
  • OS Version: 6
  • FreeTube version: bfa22f4

Additional context

i definitely have fixed this in my fork by just adding a null check, but looking into it, this seems like the true fix.

@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Feb 1, 2025
@FreeTubeBot FreeTubeBot enabled auto-merge (squash) February 1, 2025 02:09
@absidue
Copy link
Member

absidue commented Feb 1, 2025

Looking at the commit where it was removed, which you linked the ref was actually on another element back then, specifically the div around the search bar that has the searchContainer class. What was the reason for chosing a different element to add it back to?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: waiting for review For PRs that are complete, tested, and ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants