Skip to content

Commit 5f035cc

Browse files
committed
breaking(options): change default key-combo for svelte-inspector to alt-x
1 parent 9fda8bb commit 5f035cc

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

.changeset/tall-monkeys-shout.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/vite-plugin-svelte-inspector': major
3+
---
4+
5+
Change default key-combo to `alt-x` to avoid conflicts with other combos that started with the previous defaults.

docs/inspector.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default {
2424
export default {
2525
vitePlugin: {
2626
inspector: {
27-
toggleKeyCombo: 'meta-shift',
27+
toggleKeyCombo: 'alt-x',
2828
showToggleButton: 'always',
2929
toggleButtonPos: 'bottom-right'
3030
}
@@ -39,7 +39,7 @@ To allow you to use your own setup, svelte inspector can be configured via envir
3939

4040
```shell
4141
# just keycombo, unquoted string
42-
SVELTE_INSPECTOR_TOGGLE=control-shift
42+
SVELTE_INSPECTOR_TOGGLE=alt-x
4343

4444
# options object as json
4545
SVELTE_INSPECTOR_OPTIONS='{"holdMode": false, "toggleButtonPos": "bottom-left"}'
@@ -58,13 +58,13 @@ SVELTE_INSPECTOR_OPTIONS=true
5858
### toggleKeyCombo
5959

6060
- **Type:** `string`
61-
- **Default:** `'meta-shift'` on mac, `'control-shift'` on other os
61+
- **Default:** `'alt-x'`
6262

6363
Define a key combo to toggle inspector.
6464

65-
The value is recommended to be any number of modifiers (e.g. `control`, `shift`, `alt`, `meta`) followed by zero or one regular key, separated by `-`. This helps avoid conflicts or accidentally typing into inputs. Note that some keys have native behavior (e.g. `alt-s` opens history menu on firefox).
65+
The value is recommended to be any number of modifiers (e.g. `control`, `shift`, `alt`, `meta`) followed by zero or one regular key, separated by `-`. Note that some keys have native behavior (e.g. `alt-s` opens history menu on firefox).
6666

67-
Examples: `control-shift`, `control-o`, `control-alt-s`, `meta-x`, `control-meta`.
67+
Examples: `control-o`, `control-alt-s`, `meta-x`, `alt-i`.
6868

6969
### navKeys
7070

packages/vite-plugin-svelte-inspector/src/options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { debug } from './debug.js';
44

55
/** @type {import('./public.d.ts').Options} */
66
export const defaultInspectorOptions = {
7-
toggleKeyCombo: process.platform === 'darwin' ? 'meta-shift' : 'control-shift',
7+
toggleKeyCombo: 'alt-x',
88
navKeys: { parent: 'ArrowUp', child: 'ArrowDown', next: 'ArrowRight', prev: 'ArrowLeft' },
99
escapeKeys: ['Backspace', 'Escape'],
1010
openKey: 'Enter',

packages/vite-plugin-svelte-inspector/src/runtime/Inspector.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
case 'meta':
143143
return event.getModifierState(key.charAt(0).toUpperCase() + key.slice(1));
144144
default:
145-
return key === event.key.toLowerCase();
145+
return key === event.key.toLowerCase() || event.code === `Key${key.toUpperCase()}`;
146146
}
147147
}
148148

0 commit comments

Comments
 (0)