Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First bullet in list sitting outside of <ul> #102

Closed
1 task
EmilyFlocc opened this issue Apr 1, 2021 · 3 comments
Closed
1 task

First bullet in list sitting outside of <ul> #102

EmilyFlocc opened this issue Apr 1, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@EmilyFlocc
Copy link

EmilyFlocc commented Apr 1, 2021

Version

module: 0.8.0
nuxt: 2.15.3

Nuxt configuration

mode:

  • [ x ] universal
  • spa

Reproduction

⚠️ without a minimal reproduction we wont be able to look into your issue

The first bullet of my list is appearing as a <li> outside of my code using SanityContent component when it is the first thing inside the box.

My sanity document field is:

{ name: 'test', type: 'array', of: [ {type: 'block'} ] },

My nuxt implementation is: (where c is my page content)

<SanityContent :blocks="c.test" />

In a basic test, where I have three bullet points, the blocks return the following JSON:

[ { "_key": "1c6db3700c85", "_type": "block", "children": [ { "_key": "2ceb3af83031", "_type": "span", "marks": [], "text": "one" } ], "level": 1, "listItem": "bullet", "markDefs": [], "style": "normal" }, { "_key": "2225fa05c5ca", "_type": "block", "children": [ { "_key": "5e58e5f761fe", "_type": "span", "marks": [], "text": "two" } ], "level": 1, "listItem": "bullet", "markDefs": [], "style": "normal" }, { "_key": "17c1b0f23100", "_type": "block", "children": [ { "_key": "60921bf5a711", "_type": "span", "marks": [], "text": "three" } ], "level": 1, "listItem": "bullet", "markDefs": [], "style": "normal" } ]

This outputs in the DOM as the following:

<div><li>one</li><ul><li>two</li><li>three</li></ul></div>

As you can see, the first item isn't in the <ul> as it should be. It should of returned:

<div><ul><li>one</li><li>two</li><li>three</li></ul></div>

However, if I add something before my list, then it works as expected. So I have added 'This is a line of text' above the list in the portable content editor and now my SanityContent component returns the following:

<div><p>This is a line of text</p><ul><li>one</li><li>two</li><li>three</li></ul></div>

So it's only an issue when a bullet list is the first thing inside the portable content block.

@EmilyFlocc EmilyFlocc added the bug Something isn't working label Apr 1, 2021
@ovsw
Copy link

ovsw commented Apr 11, 2021

+1, getting this as well

Copy link
Collaborator

This should now be fixed in v0.9.0 - let me know if it doesn't solve it for you.

@EmilyFlocc
Copy link
Author

It seems to be fixed now - thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants