Closed (fixed)
Project:
Webform
Version:
8.x-5.23
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
18 Jan 2021 at 17:26 UTC
Updated:
3 Feb 2021 at 13:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
sutharsan commentedCan be reproduced in 6.0.0 too.
Comment #3
jrockowitz commentedI think this issue is coming from Drupal core.
@see #997826: #states doesn't work correctly with type text_format
Please test the recommended patch and see if it resolves this issue.
Comment #4
sutharsan commentedI have tried the patch with on core 9.1.2 (with webform 6.0) and on core 8.9.11 (manual patch; with webform 8.x-5.19), but it does not fix the problem. I also applied the work around suggested in the issue by wrapping the editor a container but also no luck. I therefore think we have a different issue here.
Comment #5
sutharsan commentedI tracked it down to
clearValueAndRequiredin webform.states.js. One of the input fields it is called upon is theformatted_text[format]input field. Without a format, the editor no longer works. We should not clear this field since because the user can never restore its value.The easiest approach I found is to not clear the value of hidden fields.
Comment #7
sutharsan commentedComment #8
sutharsan commentedComment #9
jrockowitz commentedNot clearing the value of hidden fields could cause unexpected regressions.
It would be safer to specifically not clear hidden inputs for text formats.
BTW, thanks for figuring out the source of the problem.
Comment #10
jrockowitz commentedComment #12
jrockowitz commentedComment #13
sutharsan commentedLess is more :) This is indeed the better solution.
Tested the patch and it works. It also fixes the (hypothetical) case that multiple text formats are presented in a select list.
Comment #15
jrockowitz commented