Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

initialFocus did not return a node #1752

Closed
1 task done
ramadanomar opened this issue Aug 28, 2022 · 4 comments
Closed
1 task done

initialFocus did not return a node #1752

ramadanomar opened this issue Aug 28, 2022 · 4 comments
Labels
💻 aspect: code Concerns the software code in the repository bug Something isn't working 🛠 goal: fix Bug fix 🟨 priority: medium Not blocking but should be addressed soon
Projects

Comments

@ramadanomar
Copy link
Contributor

Description

While looking into #1737, i found that i occasionally receive Uncaught Error: initialFocus did not return a node while clicking the mobile filter button repeatedly. Could possibly be the reason of the tests failing

Reproduction

  1. go to https://search-production.openverse.engineering/search/?q=cat
  2. enter dev tools and select mobile (responsive mode)
  3. you can also edit user agent if you want but it works on all that i tried (samsung,iphone,huawei)
  4. spam the filter button with the console open until you see the error

Screenshots

image

Environment

I tried using both the development branch of chrome (Chrome dev) and firefox stable branch on ubuntu 20.04 lts. Tried a couple of UA but seems to be reproducible on any environment but only sometimes

Resolution

  • 🙋 I would be interested in resolving this bug.

I'm looking into it right now, if you know what might be causing it lmk!

@ramadanomar ramadanomar added bug Something isn't working 🟨 priority: medium Not blocking but should be addressed soon 🛠 goal: fix Bug fix labels Aug 28, 2022
@ramadanomar ramadanomar self-assigned this Aug 28, 2022
@openverse-bot openverse-bot added this to Backlog in Openverse Aug 28, 2022
@obulat
Copy link
Contributor

obulat commented Aug 29, 2022

@ramadanomar, this is a known issue from the upstream dependencies, focus-trap-vue and focus-trap. The warning about initialFocus can be ignored, because Openverse uses its own, more flexible, implementation for managing focus while inside the modal, not the focus-trap one.
@sarayourfriend opened a PR in focus-trap-vue repository to fix this warning, which was merged, but only to the version that supports Vue 3.

I think the best way of fixing this warning, in the long run, is to use useFocusTrap from Vueuse: https://vueuse.org/integrations/usefocustrap/. I tried adding it, but there are some problems importing the hook in Nuxt 2 that I couldn't figure out.

@ramadanomar
Copy link
Contributor Author

Then shouldn't we catch the error and prevent it from appearing in console?

@obulat
Copy link
Contributor

obulat commented Aug 29, 2022

Yes, it would be nice to catch it, @ramadanomar. I'm not sure where we can actually catch the focus-trap error, though.

@ramadanomar ramadanomar added the 🚧 status: blocked Blocked & therefore, not ready for work label Aug 29, 2022
@obulat obulat added 💻 aspect: code Concerns the software code in the repository and removed 🚧 status: blocked Blocked & therefore, not ready for work labels Aug 30, 2022
@openverse-bot openverse-bot moved this from Backlog to In progress in Openverse Aug 30, 2022
@zackkrida zackkrida moved this from In progress to To do in Openverse Sep 6, 2022
@zackkrida zackkrida moved this from To do to Backlog in Openverse Sep 6, 2022
@openverse-bot openverse-bot moved this from Backlog to In progress in Openverse Sep 6, 2022
@zackkrida zackkrida moved this from In progress to Backlog in Openverse Oct 4, 2022
@openverse-bot openverse-bot moved this from Backlog to In progress in Openverse Oct 4, 2022
@obulat
Copy link
Contributor

obulat commented Dec 6, 2022

Fixed in #1993

@obulat obulat closed this as completed Dec 6, 2022
Openverse automation moved this from In progress to Done! Dec 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
💻 aspect: code Concerns the software code in the repository bug Something isn't working 🛠 goal: fix Bug fix 🟨 priority: medium Not blocking but should be addressed soon
Projects
No open projects
Openverse
  
Done!
Development

Successfully merging a pull request may close this issue.

2 participants