lichess-org/pgn-viewer

Setting 'showControls: false' in params results in failure to render

Lou-E-303 opened this issue · 1 comments

Hi,

I am trying to follow schlawg's blog post on the pgn viewer, and have gotten to the bit where you add some extra options.

I tried adding some of the extra options like drawArrows: true etc., and they all seem to work, except for one - I noticed when testing that for whatever reason, showControls: false breaks it - when I click the render button, nothing happens and there's nothing in the console to indicate failure. All of the other options work fine.

Any idea why this might be?

My full code can be found here.

Output after clicking Render when showControls: false commented out:

image

Output after clicking Render when showControls: false uncommented:

image

Note also that the 'issue' you see on the right of the console is as follows:

image

And as you can see, doesn't seem to be the problem since it also appears when showControls: false is commented out.


EDIT: Also worth noting that:

  • Setting showControls: true doesn't break it, indicating some issue with the false flow itself
  • I experienced the same issue in Firefox, Chrome and Safari

Hi. Currently the controls are the only thing that make the viewer have any width on your page. With showControls: false the viewer is added to the DOM, but with size 0. Try to give the container some non-zero width in your CSS.