webBrowser incorrect key strokes

There is an issue with specific characters in the webBrowser component. specifically > & ’ do not enter correctly, they show up correctly in the table but show up within the browser as . & # respectively.

replicated this behaviour on two windows machines.

tested copy & paste for those characters still works

2023.11600 commercial & 2023.11880 non commercial

Hey @shamanic

What is your keyboard layout?

Best,
Michel

all 3 keyboards tested are qwerty UK variants.
windows doesnt seem to have a good native tool to check the exact keyboard specs

I’m seeing an issue with the > only being sent as . on a US QWERTY. Can’t repro the other one.

But this is logged to be looked into.

Best,
Michel

Probably same issue:

I was having this same issue with international keyboards on a project. I was able to solve it by rewriting the keyboardin1_callbacks in the WebBrowser comp with the following script:

# me - this DAT
# 
# dat - the DAT that received the key event
# key - the name of the key attached to the event
# character - the ASCII value of the pressed key as a string
# alt - True if the alt modifier is pressed
# ctrl - True if the ctrl modifier is pressed
# shift - True if the shift modifier is pressed
# state - True if the event is a key press event
# time - the time when the event came in milliseconds

def onKey(dat, key, character, alt, lAlt, rAlt, ctrl, lCtrl, rCtrl, shift, lShift, rShift, state, time):
	if state:
		if character != '' and character in "@€~\\{}[]|.,":
			ui.clipboard = character
			op('webrender1').sendKey('v', ctrl=1)
		elif key.isdigit():
			op('webrender1').sendKey(ord(key), alt=alt, ctrl=ctrl, shift=shift)
		else:
			op('webrender1').sendKey(key, alt=alt, ctrl=ctrl, shift=shift)

# shortcutName is the name of the shortcut

def onShortcut(dat, shortcutName, time):
	return;
	

This has been working with the German layout keyboards I’ve tested, including all the special characters. If a character is still incorrect it can be added to the second if statement in the quoted string of custom characters. The downside is that it uses copy/paste to paste the character into the browser, so it may overwrite your clipboard.

Hope that helps!

Nice! Smart solution. Im hoping to make my component able to support any keyboard configuration, so maybe I can add a way for the users to set / select their specific keyboard configuration. thanks for this

Nice workaround, but it also clears the clipboard, what might be unwanted.
So a real bug fix is still necessary.