From 3406c2f800629f622a58fa02cae5271ee9133d03 Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Mon, 12 Apr 2021 00:07:25 +0800 Subject: [PATCH] Wunderbar: handle 'shift+home' key not highlighting text ## Issue - Patch for 5316: "Home and End keys not working in search box" ## Notes Seems like 'shift+home' wasn't highlighting the text. 'shift+end' works. Was pretty sure I tested that previously. Anyway, adding the direction variable seems to fix it. --- ui/component/wunderbarSuggestions/view.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/component/wunderbarSuggestions/view.jsx b/ui/component/wunderbarSuggestions/view.jsx index 1255500d9..c8e58189f 100644 --- a/ui/component/wunderbarSuggestions/view.jsx +++ b/ui/component/wunderbarSuggestions/view.jsx @@ -134,18 +134,20 @@ export default function WunderBarSuggestions(props: Props) { let begin; let final; let scrollPx; + let direction = 'none'; if (isHome) { begin = 0; final = shiftKey ? cur : begin; scrollPx = 0; + direction = 'backward'; } else { final = elem.value.length; begin = shiftKey ? cur : final; scrollPx = elem.scrollWidth - elem.clientWidth; } - elem.setSelectionRange(begin, final); + elem.setSelectionRange(begin, final, direction); elem.scrollLeft = scrollPx; return true; }