debugger icon indicating copy to clipboard operation
debugger copied to clipboard

"Go to file" loses the ability to select results if hitting up or down key when results.length==0

Open fvsch opened this issue 7 years ago • 5 comments

STR:

  1. Go to https://firefox-dev.tools/debugger-examples/examples/todomvc/ and open Debugger
  2. Use the Ctrl+P shortcut to show the "Go to file" input
  3. Type a search string that matches nothing, e.g. "fjklsfljkks"
  4. Hit the Up arrow key once
  5. Remove the non-matching search string and type "back"
  6. Hit the Down arrow key once

Expected result: After step 5, two results show up, with the first result (backbone.js) highlighted in blue. In step 6, hitting the Down arrow should put the focus on the second result (backbone.localStorage.js).

Actual result: After step 5, two results show up, and no result is highlighted. In step 6, no result is highlighted.

fvsch avatar Mar 13 '19 16:03 fvsch

Using React Devtools, it looks like when you hit Up or Down in "Go to file" and there are currently 0 results, the state.selectedIndex ends up being NaN. From them on, if we try to add or substract 1 to that index, it will remain stuck at NaN, breaking the keyboard navigation completely.

Debugger screenshot

fvsch avatar Mar 13 '19 17:03 fvsch

Great find @fvsch !

darkwing avatar Mar 13 '19 17:03 darkwing

the good ol' divide by zero game!

WenInCode avatar Mar 14 '19 18:03 WenInCode

/claim

WenInCode avatar Mar 14 '19 18:03 WenInCode

Thanks for claiming the issue! :wave:

Here are some links for getting setup, contributing, and developing. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.

:fox_face: Debugger team!

claim avatar Mar 14 '19 18:03 claim