addon-controls text input cannot handle Japanese (most likely all CJK text)
See original GitHub issueDescribe the bug addon-controls’ text-input doesn’t handle Japanese typing events. Most likely caused by listening to oninput instead of onchange. Pasted Japanese text displays normally.
To Reproduce
- Create a control that has a text input
- Try typing Japanese directly into input (ex. 編集)
- See garbled string
Expected behavior Input contains string “編集”. Copying and pasting this string will display expected result. Actually typing the text into the input causes the error.
Screenshots https://www.loom.com/share/5310ef1bd23e4f07b9c93ee528d0c948
System:
Environment Info:
System:
OS: macOS 10.15.5
CPU: (8) x64 Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
Binaries:
Node: 14.3.0 - /var/folders/q6/mtqdcmhs7nl4zxxpdf0tr_xm0000gn/T/fnm-shell-1945621/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.5 - /var/folders/q6/mtqdcmhs7nl4zxxpdf0tr_xm0000gn/T/fnm-shell-1945621/bin/npm
Browsers:
Chrome: 83.0.4103.116
Safari: 13.1.1
npmPackages:
@storybook/addon-controls: ^6.0.0-beta.37 => 6.0.0-beta.37
@storybook/addon-docs: ^6.0.0-beta.37 => 6.0.0-beta.37
@storybook/angular: ^6.0.0-beta.37 => 6.0.0-beta.37
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Text Editing Hates You Too - Hacker News
For decades I've been saying that all text input should go through OS-level IMEs (input method editors). For more complex scripts, the need...
Read more >[APP] Japanese display and input addon (updated 2009.07.03 ...
What this does is that it enables display and input of Japanese characters. It can for instance be used to read web pages,...
Read more >CJK(Chinese, Japanese, Korean): extra space is inserted ...
CJK (Chinese, Japanese, Korean): extra space is inserted within text in mail due to wrap produced by mailnews.wraplength and line length limitation of...
Read more >Controls - Storybook - JS.ORG
To use the Controls addon, you need to write your stories using args. ... By default, Storybook will render a free text input...
Read more >How to Set Up the MorphMan Anki Add-On
For all other languages you'll probably want to use “Language w/ Spaces”. “CJK characters” will also work for text with Chinese characters but ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@brandonpittman i’ve lived in japan, korea, and currently in taiwan so i’m a bit embarrassed about this one. hopefully we can fix it soon, tho it turns out that it’s not as easy as i’d hoped to track down.
both controls (new, broken code) and knobs (old, working code) effectively have the same logic:
in both cases, it is a “controlled component” where the value is passed in and the onChange hooks into an external state management system. there’s something different about the
value
that’s getting passed in and i’m wondering if you know enough about CJK to help me debug.i was using korean ㅁㅏㄴ vs 만. is there a version of the string “ㅁ” that is "open to adding more characters to, and a version of the string “ㅁ” that is “end of character”? if so, how would i programmatically convert from the former to the latter? my hypothesis is that the args state management system is unintentionally making that conversion, whereas the knobs state management is not. since they are using the exact same
Form.Textarea
component.UPDATE: I replaced the knobs component with a nearly identical copy of the controls component and have confirmed it’s an issue in the state management side cc @ndelangen @tmeasday