wagtail-deprecated / wagtail-react-streamfield

Powerful field for inserting multiple blocks with nesting. (NO LONGER MAINTAINED - See Wagtail 2.13 Release Notes)
https://wagtail.github.io/react-streamfield/public/
BSD 3-Clause "New" or "Revised" License
74 stars 23 forks source link

Radio buttons display and functionality broken #36

Closed biki closed 5 years ago

biki commented 5 years ago

Wagtail 2.4 Wagtail react streamfield 1.2.0

Radio buttons within the edit form don't have enough space and grow into each other. Also they look like they're not properly given a name attribute which is why you're able to select more than one.

image

Note that radio buttons are not default Wagtail, but a customized ChoiceBlock: image

BertrandBordage commented 5 years ago

Half of that issue was fixed by https://github.com/wagtail/react-streamfield/commit/e775cd303323daabc6de824d23b1d74d6cb35354. That fix is for the exclusive selection of a single radio button at a time.

What remains is to fix the CSS issue, it’s purely wagtail related.

BertrandBordage commented 5 years ago

The style issue was fixed by 45dcaf232020c0adc8af7db5917536d9b1c0de82, and the react-streamfield fix is in the version used by wagtail-react-streamfield now.

So everything here is fixed, and will be in the new wagtail-react-streamfield version :)

biki commented 5 years ago

Unfortunately I have to open this issue again, it is still somewhat broken in 1.3.0

Screenshot 2019-08-08 at 08 32 37

Getting the following error:

Screenshot 2019-08-08 at 08 33 41

If you need more information from me, please say so. Thank you.

BertrandBordage commented 5 years ago

@biki Did you try force-refreshing the browser? With +shift+R on Apple computers and ctrl+F5 on everything else.

biki commented 5 years ago

Yep. I know that Wagtail sometimes bugs out after updating but I've cleared the cache multiple times.

BertrandBordage commented 5 years ago

Was it using the exact RadioBlock you defined above? I’m asking because that’s what I used for testing, and it was working flawlessly.

biki commented 5 years ago

Yep, using the same definition on Wagtail 2.6.1 I'm using RadioBlock like this:


image_text_cubes = ('image_text_cubes', blocks.StructBlock([
    ('title', blocks.CharBlock(required=False)),
    ('cubes', blocks.ListBlock(blocks.StructBlock([
        ('image', ImageChooserBlock()),
        ('image_position', RadioBlock(choices=DEFAULT_ALIGNMENT_CHOICES[:2], default='left')),
        ('title', blocks.CharBlock()),
        ('content', blocks.RichTextBlock()),
        ('list_style', RadioBlock(choices=DEFAULT_LIST_CHOICES, default='dash')),
        ('call_to_actions', blocks.ListBlock(CallToActions(), default=[], required=False, null=True, blank=True)),
    ]))),
], template='content/blocks/image_text_cubes.html', icon='fa-cubes', group=GROUP_NAME))```
BertrandBordage commented 5 years ago

OK, I can confirm I see a buggy behaviour with RadioBlock after values were saved with the old StreamField. I’m investigating it.

BertrandBordage commented 5 years ago

That last issue was fixed by df10ce3caeab994cb2864b18d611ef3cdfe37ff6. It was a bad radio serialization issue. I discovered another issue at the same time, one method was not correctly monkey patched, so the error messages were no longer shown in the field blocks.

That should fix your issue, tell me otherwise!

BertrandBordage commented 5 years ago

I forgot to tell you, it’s in a new 1.3.1 release.