Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Wrapper CSS classes not visible when "custom" selected.
Steps to reproduce issue.
- Go to admin/structure/webform/manage/contact
- Edit your name element.
- Open "WRAPPER ATTRIBUTES" and select "custom" in "Wrapper CSS classes"
- Add custom class in new field
- Save field and again edit, css class field is not visible
Proposed resolution
Add fixed width to css class field using css
Remaining tasks
NA
User interface changes
NA
Comment | File | Size | Author |
---|---|---|---|
#8 | fix_width-2902045-8.patch | 528 bytes | Vj |
| |||
#7 | wrapper_css_classes-2902045-7.patch | 628 bytes | jrockowitz |
| |||
#5 | wrapper_css_classes-2902045-5.patch | 917 bytes | jrockowitz |
| |||
#5 | webform.webform.issue_2902045.yml | 2.72 KB | jrockowitz |
#3 | fix_css-2902045-4.patch | 435 bytes | Vj |
|
Comments
Comment #2
Vj CreditAttribution: Vj as a volunteer commentedComment #3
Vj CreditAttribution: Vj as a volunteer commentedAdded css to fix this issue. Please review
Comment #4
Vj CreditAttribution: Vj as a volunteer commentedComment #5
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commented@Vj we need to avoid using the !important property whenever possible.
This issue is not just impacting the webform UI. Attached is a webform that replicates the issue.
The exact issue is the 'other' element is within an initially closed 'details' element.
The solution is to quickly open and then close the parent 'details' element while showing the 'other' element.
Comment #6
Vj CreditAttribution: Vj as a volunteer commented@jrockowitz
I agree we should not use !important property. I tried using JS but it was not working. I just applied your patch. but still its doing same on first load and click on edit. If i close the popup and again click on edit then it works correctly.
Let me know if i can help
Comment #7
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedMmmm... This looks like a JS issue because the 'other' element's width is being set to 0px because the parent element is hidden.
Attached patch tries to account for this issue.
Comment #8
Vj CreditAttribution: Vj as a volunteer commented@jrockowitz
applied patch #7 but its still not working as expected.
width is 0 on first load, so $element width is still 0 too.
I tried to set width 100% using javascript so we dont have to use important property. Please review and let me know if we can go with this method.
Comment #9
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedPatch #7 only applies the width if it is not 0.
With patch #7, I am having no issue with the other text field's width.
Can you make sure to clear your browser's cache when testing the patch.
Comment #10
Vj CreditAttribution: Vj as a volunteer commented@jrockowitz
applied patch #7 and cache clear did the trick. Confirmed patch works. Thank you
Comment #12
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commented