Skip to content

Commit

Permalink
handle shift+tab in autocomplete (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
kochis authored Aug 14, 2024
1 parent 1679809 commit 65cf467
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/ui/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ class AutocompleteUI {

const radarLogo = document.createElement('span');
radarLogo.id = 'radar-powered-logo';
radarLogo.textContent = 'Radar';
link.appendChild(radarLogo);

const poweredByContainer = document.createElement('div');
Expand Down Expand Up @@ -401,13 +402,18 @@ class AutocompleteUI {
}

public handleKeyboardNavigation(event: KeyboardEvent) {
const key = event.key;
let key = event.key;

// allow event to propagate if result list is not open
if (!this.isOpen) {
return;
}

// treat shift+tab as up key
if (key === 'Tab' && event.shiftKey) {
key = 'ArrowUp';
};

switch (key) {
// Next item
case 'Tab':
Expand Down
1 change: 1 addition & 0 deletions styles/radar.css
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@
margin-left: 4px;
width: 40px;
height: 10px;
color: transparent;
background: url('data:image/svg+xml;charset=utf-8,<svg width="40" height="10" viewBox="0 0 40 10" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M11.4621 8.83575V1.207H14.2936C16.1847 1.207 17.2364 2.01789 17.2364 3.62899V3.67167C17.2364 4.75997 16.6903 5.36814 15.9319 5.67755L17.6611 8.83575H15.4768L14.0105 6.10434H13.5251V8.83575H11.4621ZM13.5251 4.68528H14.1925C14.8903 4.68528 15.2341 4.37586 15.2341 3.75703V3.71435C15.2341 3.09551 14.87 2.85011 14.2026 2.85011H13.5251V4.68528ZM19.7848 8.96379C18.8342 8.96379 17.9948 8.47299 17.9948 7.28866C17.9948 5.9763 19.0466 5.46416 20.8062 5.46416H21.3118V5.33613C21.3118 4.80265 21.1905 4.45055 20.614 4.45055C20.1185 4.45055 19.9365 4.75997 19.896 5.11207H18.1971C18.278 3.7677 19.2792 3.10618 20.7253 3.10618C22.1815 3.10618 23.1119 3.73569 23.1119 5.21876V8.83575H21.3523V8.18491C21.0994 8.59035 20.6343 8.96379 19.7848 8.96379ZM20.4118 7.67277C20.9275 7.67277 21.3118 7.36335 21.3118 6.88322V6.54179H20.8365C20.1084 6.54179 19.7848 6.69116 19.7848 7.14996C19.7848 7.47005 19.987 7.67277 20.4118 7.67277ZM26.1052 8.96379C24.8816 8.96379 23.8804 8.03553 23.8804 6.10434V6.01898C23.8804 4.11979 24.8715 3.10618 26.1254 3.10618C26.9547 3.10618 27.4502 3.47962 27.7536 4.04511V0.801553H29.5637V8.83575H27.7536V7.92884C27.4906 8.50499 26.9041 8.96379 26.1052 8.96379ZM26.7423 7.50205C27.3996 7.50205 27.8041 7.02192 27.8041 6.07233V5.98697C27.8041 5.04805 27.43 4.54658 26.7625 4.54658C26.085 4.54658 25.7209 5.02671 25.7209 5.99764V6.083C25.7209 7.02192 26.1153 7.50205 26.7423 7.50205ZM32.1222 8.96379C31.1716 8.96379 30.3323 8.47299 30.3323 7.28866C30.3323 5.9763 31.384 5.46416 33.1436 5.46416H33.6493V5.33613C33.6493 4.80265 33.5279 4.45055 32.9515 4.45055C32.456 4.45055 32.2739 4.75997 32.2335 5.11207H30.5346C30.6155 3.7677 31.6166 3.10618 33.0627 3.10618C34.5189 3.10618 35.4493 3.73569 35.4493 5.21876V8.83575H33.6897V8.18491C33.4369 8.59035 32.9717 8.96379 32.1222 8.96379ZM32.7492 7.67277C33.265 7.67277 33.6493 7.36335 33.6493 6.88322V6.54179H33.174C32.4458 6.54179 32.1222 6.69116 32.1222 7.14996C32.1222 7.47005 32.3245 7.67277 32.7492 7.67277ZM36.4808 8.83575H38.291V6.18969C38.291 5.29345 38.8977 4.93068 40 4.96269V3.18087C39.1809 3.1702 38.6247 3.53297 38.291 4.36519V3.25556H36.4808V8.83575Z" fill="%235A6872"/><path fill-rule="evenodd" clip-rule="evenodd" d="M3.87125 0L0 9.98971L3.87125 8.31318L7.74251 10L3.87125 0Z" fill="%235A6872"/></svg>');
}

Expand Down

0 comments on commit 65cf467

Please sign in to comment.