{"action":"created","issue":{"url":"https://api.github.com/repos/kangax/fabric.js/issues/2051","labels_url":"https://api.github.com/repos/kangax/fabric.js/issues/2051/labels{/name}","comments_url":"https://api.github.com/repos/kangax/fabric.js/issues/2051/comments","events_url":"https://api.github.com/repos/kangax/fabric.js/issues/2051/events","html_url":"https://github.com/kangax/fabric.js/issues/2051","id":63475277,"number":2051,"title":"[IText] IText is unusable for accent based languages","user":{"login":"marcospassos","id":943036,"avatar_url":"https://avatars.githubusercontent.com/u/943036?v=3","gravatar_id":"","url":"https://api.github.com/users/marcospassos","html_url":"https://github.com/marcospassos","followers_url":"https://api.github.com/users/marcospassos/followers","following_url":"https://api.github.com/users/marcospassos/following{/other_user}","gists_url":"https://api.github.com/users/marcospassos/gists{/gist_id}","starred_url":"https://api.github.com/users/marcospassos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcospassos/subscriptions","organizations_url":"https://api.github.com/users/marcospassos/orgs","repos_url":"https://api.github.com/users/marcospassos/repos","events_url":"https://api.github.com/users/marcospassos/events{/privacy}","received_events_url":"https://api.github.com/users/marcospassos/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":17,"created_at":"2015-03-22T01:36:43Z","updated_at":"2015-03-31T02:02:09Z","closed_at":null,"body":"Currently, the IText input binding strategy has some issues and one of most critical one is that IText is completely unusable for accent based languages (such as Portuguese, Spanish, Japanese, Chinese, etc) due the lack of support to [dead keys](http://en.wikipedia.org/wiki/Dead_key).\r\n\r\n**The problem**\r\nIText uses a hidden input for capturing user's input, through the [`keydown` event](https://github.com/kangax/fabric.js/blob/4ad253ffba4f98b3161d46c6a3f86b9d403a16c7/src/mixins/itext_key_behavior.mixin.js#L160). The problem is that `keydown` events originated from dead keys cannot be converted into characters, because the event does not provide the character's code but a fixed key code (229) instead.\r\n\r\nExamples:\r\n\r\nKey | Key Code | Expected Result\r\n----- | ------------- | --------\r\n~ | `229` | ~\r\n' `+` c | `229`, `229` | ç\r\n~ `+` a | `229`, `229` | ã\r\n\" `+` u | `229`, `229` | ü\r\n~ `+` ~ | `229`, `229` | ~~\r\n~ `+` ~ `+` ~ `+` a | `229`, `229`, `229`, `229` | ~~ã\r\n~ `+` [space]| `229`, `229` | ~ [trimmed, no space]\r\n\r\nNotice that pressing `a` after a dead key produces another dead key event. So, it's very hard to handle it in the way it's currently architected.\r\n\r\nHolding the key of a given character to choose one of its variants is OS specific and almost no user of accented keyboards is familiar with this, so it's not a good alternative IMHO. I've been trying to fix it in the last days, but seems like we should change the way it is currently done, once we'll have to reimplement basic browsers/OS features bringing a lot of unnecessary code overhead.\r\n\r\nUnfortunately, we've been working on a big startup project in the last months without noticing this issue and maybe we'll have to stop it immediately, at least until discover a workaround.\r\n\r\nRelated issues: #1175 and #1954\r\n\r\n<bountysource-plugin>\r\n---\r\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/9855309-itext-itext-is-unusable-for-accent-based-languages?utm_campaign=plugin&utm_content=tracker%2F23217&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F23217&utm_medium=issues&utm_source=github).\r\n</bountysource-plugin>"},"comment":{"url":"https://api.github.com/repos/kangax/fabric.js/issues/comments/87898103","html_url":"https://github.com/kangax/fabric.js/issues/2051#issuecomment-87898103","issue_url":"https://api.github.com/repos/kangax/fabric.js/issues/2051","id":87898103,"user":{"login":"taveras","id":114454,"avatar_url":"https://avatars.githubusercontent.com/u/114454?v=3","gravatar_id":"","url":"https://api.github.com/users/taveras","html_url":"https://github.com/taveras","followers_url":"https://api.github.com/users/taveras/followers","following_url":"https://api.github.com/users/taveras/following{/other_user}","gists_url":"https://api.github.com/users/taveras/gists{/gist_id}","starred_url":"https://api.github.com/users/taveras/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taveras/subscriptions","organizations_url":"https://api.github.com/users/taveras/orgs","repos_url":"https://api.github.com/users/taveras/repos","events_url":"https://api.github.com/users/taveras/events{/privacy}","received_events_url":"https://api.github.com/users/taveras/received_events","type":"User","site_admin":false},"created_at":"2015-03-31T02:02:08Z","updated_at":"2015-03-31T02:02:08Z","body":"Tested this last page (http://www.deltalink.it/andreab/fabric/test3.html) on a Mac, running 10.10.2 Yosemite, using both the US International keyboard, Chinese - Traditional Keyboard, and Japanese - Hiragana keyboard. I tested this in the latest versions of Chrome, Firefox, and Safari. \r\n\r\nThe related issue #1529 I would consider resolved with this change. Good work!"}}