Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

breaking(options): change default key-combo for svelte-inspector to alt-x #995

Merged
merged 2 commits into from
Oct 17, 2024

Conversation

dominikg
Copy link
Member

Why alt-x?

It should be 2 key, and usable with one hand. And most importantly not conflict with a lot of other key-combos.

The previous defaults (ctrl-shift or meta-shift) are used in many combos so they accidentally triggered the inspector eg when making a screenshot with meta-shift-3 on mac.

During my testing, alt-x did not trigger anything in linux, windows, mac for chrome or firefox, which should cover most users setups for development.

default:
return key === event.key.toLowerCase();
return key === e.code.replace(/^Key/, '').toLowerCase() || key === e.key.toLowerCase();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change helps detecting the physical key if the modifier changed what event.key is. (eg alt-x produces a double-tilde on mac)

took the liberty to slightly refactor the is_ helpers below to all use this logic to avoid inconsistencies.
Using toLowerCase allows the user to use mixed casing in their config, Alt-X, alt-x and alt-X all work the same

@dominikg dominikg merged commit 213fedd into main Oct 17, 2024
6 checks passed
@dominikg dominikg deleted the inspector-default-keys branch October 17, 2024 20:09
@github-actions github-actions bot mentioned this pull request Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant