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

IntlBackslash swapped with Backquote on ISO keyboards on Chrome & Firefox #163432

Open
samdenty opened this issue Oct 12, 2022 · 18 comments
Open
Assignees
Labels
chromium Issues and items related to Chromium firefox Issues running VSCode in Web on Firefox keyboard-layout Keyboard layout issues macos Issues with VS Code on MAC/OS X upstream Issue identified as 'upstream' component related (exists outside of VS Code) upstream-issue-linked This is an upstream issue that has been reported upstream web Issues related to running VSCode in the web
Milestone

Comments

@samdenty
Copy link
Contributor

samdenty commented Oct 12, 2022

The keybindings are broken on MacOS for "`" & "§". You can see this by going to https://vscode.dev / https://github.dev on MacOS, opening the keyboard shortcut picker, clicking on a shortcut to edit & pressing both them keys.

Alternatively you can reproduce by pressing "CTRL+`", to open the terminal which doesn't work

ScanCode 106 (106 in enum) is detected as IntlBackslash (§) when it should be "`"

IntlBackslash,
.

This is with the British layout:
CleanShot 2022-10-12 at 15 28 58@2x

@fny
Copy link

fny commented Oct 12, 2022

Hmm... this works for me (ctrl + `), but I have a different issue. The keybindings from my window tiling app stopped working entirely. Perhaps related?

@samdenty
Copy link
Contributor Author

I think that's because vscode intercepts all keyboard shortcuts, COMMAND+SHIFT+B to toggle bookmarks bar also doesn't work

@fny
Copy link

fny commented Oct 12, 2022

Just to add, I noticed this change after upgrading to the latest release.

@roblourens
Copy link
Member

@samdenty
Copy link
Contributor Author

samdenty commented Oct 18, 2022

@roblourens is there a reason why it's broken in VSCode Web, but not on desktop? Setting keyboard.dispatch to keyCode fixes web, but it works with code on desktop

@alexdima
Copy link
Member

is there a reason why it's broken in VSCode Web

Yes, on the desktop we have a native node module which we use to detect the key mappings. On the web, we need to rely on web APIs, which are incomplete.

@alexdima alexdima added web Issues related to running VSCode in the web keybindings VS Code keybinding issues labels Oct 23, 2022
@fny
Copy link

fny commented Oct 23, 2022 via email

@MasterInQuestion
Copy link

MasterInQuestion commented Nov 11, 2022

= Keybindings broken in VSCode web =

    Similar also happening on Android:
    |*| 【F1】 ("Command Palette") outright not responding.
    |*| 【Ctrl】 + 【A】 ("Select All") has no effect [1] while 【Ctrl】 + 【C】/【V】 ("Copy" / "Paste") would work.
    |*| 【Tab】 could not be trapped. (causes keyboard navigation)
    |*| And many more.
[1] Not happening in Chromium.

    Setting `"keyboard.dispatch": "keyCode"` fixes the problem.

    ----

    The portable way that should work from ancient IE to any modern mainstream browser is:
(JavaScript)
[[

	if (
	e.ctrlKey === true &&
	(
	e.keyCode === 65 ||
	e.which === 65 ) ) {

//	E.g. handling 【Ctrl】 + 【A】.
	};

]]

@alexdima
Copy link
Member

alexdima commented Dec 6, 2022

@fny @MasterInQuestion Keybindings are OS, browser and keyboard layout dependent, which means you are running into problems which are distinct from the problem reported by the OP. Please open separate issues if you still have keybindings problems.

@alexdima alexdima changed the title Keybindings broken in VSCode web, MacOS IntlBackslash mixed up with Backquote in VSCode web, MacOS, British keyboard layout Dec 6, 2022
@alexdima
Copy link
Member

alexdima commented Dec 6, 2022

@samdenty What browser are you using?

@alexdima alexdima added the info-needed Issue requires more information from poster label Dec 6, 2022
@samdenty
Copy link
Contributor Author

samdenty commented Dec 6, 2022

Chrome on MacOS with British layout

@alexdima
Copy link
Member

alexdima commented Dec 6, 2022

@samdenty Thanks for your prompt reply. I believe this is caused by this piece of code in Chromium: https://source.chromium.org/chromium/chromium/src/+/main:ui/events/keycodes/keyboard_code_conversion_mac.mm;l=809-820?q=LMGetKbdType%20package:%5Echromium$&ss=chromium where they swap Backslash and IntlBackslash on macOS on ISO keyboards. For the VS Code build, we maintain a patch where we delete that code. We hit this before with #24153

Does this reproduce in Firefox?

Edit: Found a newer bug on Chromium's side: https://bugs.chromium.org/p/chromium/issues/detail?id=1296783 fyi @deepak1556

@alexdima alexdima added macos Issues with VS Code on MAC/OS X keyboard-layout Keyboard layout issues chromium Issues and items related to Chromium and removed keybindings VS Code keybinding issues labels Dec 6, 2022
@samdenty
Copy link
Contributor Author

samdenty commented Dec 6, 2022

It works for me in safari but it's broken for me in Firefox & Chrome with keyboard.dispatch: code. Setting it to keycode fixes it, but makes both keys input the '`' character instead of IntlBackslash

@alexdima
Copy link
Member

alexdima commented Dec 6, 2022

Issue for Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1755096

@alexdima alexdima added upstream Issue identified as 'upstream' component related (exists outside of VS Code) upstream-issue-linked This is an upstream issue that has been reported upstream and removed info-needed Issue requires more information from poster labels Dec 6, 2022
@alexdima alexdima added the firefox Issues running VSCode in Web on Firefox label Dec 6, 2022
@alexdima alexdima changed the title IntlBackslash mixed up with Backquote in VSCode web, MacOS, British keyboard layout IntlBackslash swapped with Backquote on ISO keyboards Dec 6, 2022
@alexdima alexdima changed the title IntlBackslash swapped with Backquote on ISO keyboards IntlBackslash swapped with Backquote on ISO keyboards on Chrome & Firefox Dec 6, 2022
@deepak1556
Copy link
Collaborator

Found a newer bug on Chromium's side: https://bugs.chromium.org/p/chromium/issues/detail?id=1296783

Awesome, this should help us remove the patch.

@samdenty
Copy link
Contributor Author

samdenty commented Dec 7, 2022

Yep, I can confirm it's broken in both Firefox/Chrome with doing:

window.onkeydown = (e) => console.log("code:", e.code, "key:", e.key);

@MasterInQuestion

This comment was marked as off-topic.

@mardybardy
Copy link

Still broken on Chrome almost a year later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chromium Issues and items related to Chromium firefox Issues running VSCode in Web on Firefox keyboard-layout Keyboard layout issues macos Issues with VS Code on MAC/OS X upstream Issue identified as 'upstream' component related (exists outside of VS Code) upstream-issue-linked This is an upstream issue that has been reported upstream web Issues related to running VSCode in the web
Projects
None yet
Development

No branches or pull requests

9 participants