Skip to content

Commit

Permalink
Fix crash on lookup when filtered
Browse files Browse the repository at this point in the history
  • Loading branch information
Drulikar committed Jun 26, 2024
1 parent 31e1ffb commit c1a5eea
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tgui/packages/tgui/interfaces/KeyBinds.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,16 @@ export const KeyBinds = (props) => {
if (!targetEntry) {
return;
}
// If a keybind was found, scroll to the first match.
document
.getElementById(targetEntry[0])
.scrollIntoView();
// If a keybind was found, scroll to the first match currently rendered.
for (let i = 0; i < targetEntry.length; i++) {
const element = document.getElementById(
targetEntry[i],
);
if (element) {
element.scrollIntoView();
break;
}
}
}}
/>
</Flex.Item>
Expand Down

0 comments on commit c1a5eea

Please sign in to comment.