Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#44870 closed defect (bug) (maybelater)

The text will be cleared on codemirror with the Japanese Kanji input

Reported by: miyauchi's profile miyauchi Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.9
Component: I18N Keywords: has-screenshots has-patch
Focuses: administration Cc:

Description

If we entered a Japanese character, the text will be cleared.
We can see this problem on Custom HTML widget and editor screens for plugin and themes,

Attachments (2)

2018-08-30 11-40-53.2018-08-30 11_44_39.gif (130.0 KB) - added by miyauchi 6 years ago.
44870_1.patch (514 bytes) - added by ryotsun 6 years ago.

Download all attachments as: .zip

Change History (9)

#1 @mukesh27
6 years ago

  • Focuses administration added
  • Keywords has-screenshots added

#2 in reply to: ↑ description @ryotsun
6 years ago

Replying to miyauchi:

If we entered a Japanese character, the text will be cleared.
We can see this problem on Custom HTML widget and editor screens for plugin and themes,

It seems depending on editor settings of codemirror below.
https://core.trac.wordpress.org/browser/trunk/src/wp-includes/general-template.php#L3207

contenteditable should be textarea to fix this issue.

        $settings = array(
                'codemirror' => array(
                        ...
                        'inputStyle'       => 'textarea',
                        ...
                ),
                ...
        );

But I need some assistance because I'm not sure expected impact area.
(Impact area I found so far is not only customHTML widget but also "Theme Editor".)

cf.) https://codemirror.net/doc/manual.html

inputStyle: string

Selects the way CodeMirror handles input and focus. The core library defines the "textarea" and "contenteditable" input models. On mobile browsers, the default is "contenteditable". On desktop browsers, the default is "textarea". Support for IME and screen readers is better in the "contenteditable" model. The intention is to make it the default on modern desktop browsers in the future.

related issue

it may the related issue..?
https://github.com/codemirror/CodeMirror/issues/3137

Last edited 6 years ago by ryotsun (previous) (diff)

@ryotsun
6 years ago

#3 @miyauchi
6 years ago

  • Keywords has-patch added

#4 @miyauchi
6 years ago

@ryotsun

I tried your patch and it looks good to me.

But I found following in the codemirror documentation:

inputStyle: string
Selects the way CodeMirror handles input and focus. The core library defines the "textarea" and "contenteditable" input models. On mobile browsers, the default is "contenteditable". On desktop browsers, the default is "textarea". Support for IME and screen readers is better in the "contenteditable" model. The intention is to make it the default on modern desktop browsers in the future.

https://codemirror.net/doc/manual.html

I am not sure but I think it should be same behavior with the codemirror default.
So, it shoud be contenteditable on mobile and it should be textarea on desktop.(?)

#5 @ryotsun
6 years ago

@miyauchi

I am not sure but I think it should be same behavior with the codemirror default.

I agree with you. If we follow its default, it doesn’t have to set inputStyle.
But in this case, it’s a bit hard to do so because there is a known issue on mobile.
cf.)
https://github.com/codemirror/CodeMirror/issues/3137

that’s why, I guess to set textarea is a better solution for now.

#6 @netweb
6 years ago

  • Milestone changed from Awaiting Review to 4.9.9

#7 @pento
6 years ago

  • Milestone 4.9.9 deleted
  • Resolution set to maybelater
  • Status changed from new to closed
  • Version changed from 4.9.8 to 4.9

According to the CodeMirror issue, this appears to be a bug that won't be solvable until CodeMirror 6 is released, which is still some time away.

We'll certainly upgrade to CodeMirror 6 when it's released, but I don't think there's anything we can do right now.

Note: See TracTickets for help on using tickets.