Fixes a bug where Polaris cards would stick to each other when they should definitely be separated.
The problem stems from a mix between fields_for and Polaris. For cards to be separated, Polaris expects them to be next to each other in the DOM, with this CSS snippet. The + sign here meaning adjacent siblings.
Unfortunately, when using fields_for in Rails, it injects a hidden id field at the very end of the block, which means that if we do;
3.times do
form.fields_for :foo, :bar do
<Polaris.Card>
end
end
Meaning the CSS selector won't kick in. With this PR, I'm tweaking the way we generate the fields as to extract the Polaris card out of it, so that the inserted ID doesn't mess things up. There probably would have been a better way, but it's late...
Fixes a bug where Polaris cards would stick to each other when they should definitely be separated.
The problem stems from a mix between
fields_for
and Polaris. For cards to be separated, Polaris expects them to be next to each other in the DOM, with this CSS snippet. The+
sign here meaning adjacent siblings.Unfortunately, when using
fields_for
in Rails, it injects a hiddenid
field at the very end of the block, which means that if we do;We'll actually end up with;
Meaning the CSS selector won't kick in. With this PR, I'm tweaking the way we generate the fields as to extract the Polaris card out of it, so that the inserted ID doesn't mess things up. There probably would have been a better way, but it's late...
Best reviewed with w=1.