WordPress.org

Make WordPress Core

Opened 3 weeks ago

Last modified 2 days ago

#40974 accepted defect (bug)

Updated text widget do not save text

Reported by: rinkuyadav999 Owned by: westonruter
Milestone: 4.8.1 Priority: normal
Severity: normal Version: 4.8
Component: Widgets Keywords: has-patch needs-testing reporter-feedback
Focuses: Cc:

Description

Hi

I was testing updated text widget in 4.8. It saves text normally but when i switch visual to text 2-3 time and then

when i past text in visual and switch to text and press save button. it does not save text. Screenshot: https://i.gyazo.com/1e760893e6f830a3747204e2772a2407.mp4

Attachments (1)

40974.0.diff (1.0 KB) - added by westonruter 2 weeks ago.

Download all attachments as: .zip

Change History (12)

#1 @ketuchetan
3 weeks ago

Hi @rinkuyadav999,

I have tried to reproduce the issue as per your video. But, I am not facing this kind of issue.

Could you please give me instruction to reproduce the issue?

Thanks,

#2 @rinkuyadav999
3 weeks ago

Okay i have created a video for this issue : https://www.youtube.com/watch?v=q2ZeW2IxotI

System: Window 10 (64 bit), Firefox 53.0.3 (32 bit), WordPress 4.8, No plugin, default twenty seventeen theme.

Last edited 3 weeks ago by rinkuyadav999 (previous) (diff)

#3 @westonruter
3 weeks ago

@rinkuyadav999 I notice you're pasting the text into the widget. What about when you actually type text into the widget? It could be an issue with TinyMCE not picking up paste events properly to trigger a change.

#4 @westonruter
3 weeks ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 4.8.1

Actually, I can reproduce this issue. If you switch switch to the Text tab too quickly (in under a second specifically) after entering text into the Visual editor, then the text won't get synced into the underlying hidden due to the 1 second debouncing. That being said, it should also be syncing the TinyMCE value upon blur as well.

Here is the underlying code: https://github.com/WordPress/wordpress-develop/blob/4.8.0/src/wp-admin/js/widgets/text-widgets.js#L194-L198

#5 @westonruter
3 weeks ago

For some reason the blur event is not triggering when I click the Text tab from Visual.

#6 @rinkuyadav999
2 weeks ago

Yes, when i change changeDebounceDelay = 1000 to 1, it works but i think it creates other similar issues.

Past some text to text area in visual mode and click on text mode tab and save. it will save. Go back to Visual, remove pasted text, go to text tab and save. there will be removed text.

#7 @westonruter
2 weeks ago

The key to reproduce is to switch the tabs under the 1 second debounced NodeChange event handling.

@westonruter
2 weeks ago

#8 @westonruter
2 weeks ago

  • Keywords has-patch needs-testing added; needs-patch removed
  • Owner set to westonruter
  • Status changed from new to accepted

@rinkuyadav999 I think I see what is going on. When a user switches from the Visual to the Text tab, the TinyMCE editor is hidden and apparently in the process the blur event never triggers. I can see however that when the editor's hide method is called, it will do a save and trigger a SaveContent event. So if we switch from blur to SaveContent this seems to fix the issue. Please test 40974.0.diff.

@azaozz Does this make sense?

#9 @rinkuyadav999
2 weeks ago

Hi @westonruter

I have applied above patch. when i past text in visual and switch to text and press save button. it adds p tag and save value for first time. Now remove text in text mode and save. now go back to visual, past some text, go to text mode and save. there will be not pasted text (main issue again).

#10 @westonruter
2 days ago

  • Keywords reporter-feedback added

@rinkuyadav999 I'm having a very hard time reproducing this bug. It's hard for me to follow the steps. Could you create a video that shows the issue when you have the patch applied?

#11 @rinkuyadav999
2 days ago

Hi @westonruter

I have created a new video after applying patch 40974.0.diff : https://youtu.be/KxDlBAG0QsQ

First time, it adds p tag and second time same problem.

Note: See TracTickets for help on using tickets.