Bug report: Enter/return key in search bar does not add highlighted operation to recipe
MrYoranimo opened this issue · comments
Describe the bug
After searching for an operation using the search bar and highlighting it with the arrow keys, hitting enter does not add the operation to the recipe anymore. This appears to be a regression introduced by version 10.6.0.
To Reproduce
Steps to reproduce the behaviour:
- Click on the search bar
- Enter the partial name of a recipe, e.g. 'unescape' to find 'Unescape string' in the search results
- Use the arrow keys to highlight the 'Unescape string' operation
- Use enter/return on the keyboard
Expected behaviour
The highlighted operation ("Unescape string") gets added at the end of the current recipe.
Screenshots
n/a
Desktop (if relevant, please complete the following information):
- OS: Windows 10
- Browser: Firefox 122.0
- CyberChef version: 10.6.0
- Using Github-hosted instance: https://gchq.github.io/CyberChef/
Additional context
Since 10.6.0, it appears that, instead of sanitizing the name of the operation to be added, it is filtered based on a lookup in the list of available operations: https://github.com/gchq/CyberChef/blob/master/src/web/waiters/RecipeWaiter.mjs#L400
However, when the enter key is pressed, the innerHTML of the highlighted element amongst the search results is passed to the previously mentioned function: https://github.com/gchq/CyberChef/blob/master/src/web/waiters/OperationsWaiter.mjs#L47
As the name of the operation in the search result is formatted partially in bold to show the match with the search keywords, the innerHTML of the search result definitely does not match the name of the operation that should get added to the recipe.
Double-clicking an operation still works, as that will result in the textContent of the highlighted element getting passed on, instead of the innerHTML.
Issue is no longer present in 10.7.0, closing ticket