Skip to content

Change escape key Search Box behavior #740

@uglyreptile

Description

@uglyreptile

Many users change caps to escape on their machine. But Search Box uses event.code === 'Escape' instead of event.key === 'Escape'. It represents physical key instead of just key. If i swap caps to escape with this command: setxkbmap -option caps:escape - it doesn't work. Suggestion is to change this behavior in SearchBox.svelte file to:

<svelte:window
	onkeydown={(e) => {
		if (e.key === 'k' && (navigator.platform === 'MacIntel' ? e.metaKey : e.ctrlKey)) {
			e.preventDefault();
			$search_query = '';

			if ($searching) {
				close();
			} else {
				$searching = true;
			}
		}

		if (e.key === 'Escape') {
			close();
		}
	}}
/>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions