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

AltGr + 3/4/5/6/7/8 = "#", "{", "[", "|", "`", "\" chars are not typed on French Keyboard. #102

Open
VigibotDev opened this issue Oct 12, 2015 · 27 comments
Assignees
Labels
Milestone

Comments

@VigibotDev
Copy link

Hello,

This is a JavaScript / Browser problem:

AltGr + 3/4/5/6/7/8 = "#", "{", "[", "|", "`", "" are not typed on French Keyboard.

Same issue on project "term.js"
There is an elegant way to solve this ?

Pascal

@Gottox Gottox self-assigned this Oct 12, 2015
@Gottox Gottox added the bug label Oct 12, 2015
@Gottox
Copy link
Owner

Gottox commented Oct 12, 2015

Please recheck master

@VigibotDev
Copy link
Author

Awesome and useful trick
I test it tonight. Thanks a lot !!!!

@Gottox
Copy link
Owner

Gottox commented Oct 12, 2015

This should fix #97 too.

@Gottox
Copy link
Owner

Gottox commented Oct 13, 2015

Does it work?

@VigibotDev
Copy link
Author

Sorry for the delay, I must launch terminal.js from node-webterm ASAP.

I want to replace term.js with terminal.js on my website, just need to work on the minimal socket.io implementaiton of terminal.js (don't need static I use Apache and it reverse proxy). And the missing Cut/Past.

@Gottox
Copy link
Owner

Gottox commented Oct 13, 2015

Copy should work as it, paste can easy be added:

<input type=text id="foo">
<input type=button onclick="terminal.write(document.getElementById('foo').value)">

@VigibotDev
Copy link
Author

Just need to build before test... There is a "dist" (and minified) version inside the node package, but how I can get this from sources ?

@Gottox
Copy link
Owner

Gottox commented Oct 14, 2015

npm install; node_modules/.bin/grunt 

@VigibotDev
Copy link
Author

you are too fast lol

@VigibotDev
Copy link
Author

i just discovered grunt thanks:)

@Gottox
Copy link
Owner

Gottox commented Oct 14, 2015

fast by accident ;)

@VigibotDev
Copy link
Author

NOK:( always AltGr + 3-to-8 not working (the \ produce always a backspace delete)

@Gottox
Copy link
Owner

Gottox commented Oct 14, 2015

Do you use vanilla node-webterminal to test? Which browser and OS?

@VigibotDev
Copy link
Author

Firefox 40.0.3 / Windows Server 2012 R2 (not important, I tested on a lot of computer all the same)
I think it must work with lasts browsers Firefox/Chrome/IE

What is Vanilla ? You can look my temporary client here (static served over Apache and websocket tunnel)
http://www.serveurperso.com/temp/node-webterm/

I use special config to get many nodejs servers over Apache!

    RewriteEngine On
    RewriteCond %{REQUEST_URI} ^/(81|82)/socket.io [NC]
    RewriteCond %{QUERY_STRING} transport=websocket [NC]
    RewriteRule /(81|82)/(.*) ws://127.0.0.1:$1/$2 [P,L]
    ProxyPass /81/socket.io http://127.0.0.1:81/socket.io
    ProxyPassReverse /81/socket.io http://127.0.0.1:81/socket.io
    ProxyPass /82/socket.io http://127.0.0.1:82/socket.io
    ProxyPassReverse /82/socket.io http://127.0.0.1:82/socket.io

@Gottox
Copy link
Owner

Gottox commented Oct 14, 2015

Strange, for me it worked with the changes.

@VigibotDev
Copy link
Author

I tested empty web cache, and another computer : Firefox 31.2.0 on Windows 7 same problem:(

@VigibotDev
Copy link
Author

The keypress handler is perfect inside the Anyterm client (http://www.serveurperso.com/anyterm.html) and OK only for Firefox inside my term.js mod (http://www.serveurperso.com/terminal.php)

@Gottox
Copy link
Owner

Gottox commented Oct 14, 2015

Can you set a breakpoint to line 1384 and look for the value of String.fromCharCode(key)?

@VigibotDev
Copy link
Author

OK

@VigibotDev
Copy link
Author

I can add a realtime console.log();

@Gottox
Copy link
Owner

Gottox commented Oct 14, 2015

I think I need to use a windows instance to debug that, at least from linux, it looks fine.

I can debug it from a windows box tomorrow.

@VigibotDev
Copy link
Author

This is a cool event test http://unixpapa.com/js/testkey.html my AltGr chars work on it there is a input box

@VigibotDev
Copy link
Author

It's strange, my chars are never get from your function :

http://www.serveurperso.com/temp/node-webterm/index.html

// Taken from tty.js: https://github.com/chjj/tty.js
DomInput.prototype._keypress = function(ev) {
        var key = this.getKeyCode(ev);

console.log("Before " + String.fromCharCode(key));
        if (!key || ev.ctrlKey || ev.altKey || ev.metaKey) return;
console.log("After " + String.fromCharCode(key));

        if(ev.stopPropagation) ev.stopPropagation();
        if(ev.preventDefault) ev.preventDefault();
        this.push(String.fromCharCode(key));
        return false;
};

@VigibotDev
Copy link
Author

I also tested with your input visible and focused. same problem (get any chars but not famous AltGr...).

@VigibotDev
Copy link
Author

I discovered a working condition :
Just commented out keydown event binding inside your DomInput.
But this must create regression with other browser...
We need a elegan way to make this. sorry for my bad english lol

function DomInput(target, buffer, opts) {
        DomInput.super_.apply(this, arguments);

        target.tabIndex = 0;
        this._input = document.createElement('input');
        this._input.style.width = this._input.style.height = this._input.style.opacity = '0';
        this._input.style.border = 'none';
        this._input.style.position = 'absolute';
        this._input.style.zIndex = -10000;
        target.parentNode.insertBefore(this._input, target);
        this._addListener(target, 'focus', this._focus);
        this._addListener(this._input, 'keypress', this._keypress);
        //ends._addListener(this._input, 'keydown', this._keydown);
}

@Gottox
Copy link
Owner

Gottox commented Oct 15, 2015

I think it's possible to merge both keypress and keydown into one event listener.

@Gottox
Copy link
Owner

Gottox commented Jul 28, 2016

Maybe related to vercel/hyper#466

@Gottox Gottox added this to the 1.1 milestone Aug 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants