numbas / Numbas

A completely browser-based e-assessment/e-learning system, with an emphasis on mathematics
http://www.numbas.org.uk
Apache License 2.0
205 stars 120 forks source link

Multiple choice content in columns sometimes overflows the question body #958

Closed chrismgraham closed 1 year ago

chrismgraham commented 1 year ago

Example in this public question: https://numbas.mathcentre.ac.uk/question/11793/roots-of-a-cubic-real-polynomial/preview/

Looking further, it looks like, at the moment, this relies on the user choosing the correct number of columns. I assume that the grid template intends to split the width into the specified columns, but it doesn't quite work: there's some right padding on the li tags, so wonder if that is messing the grid up?

Screenshot below (Mac Chrome 105)

Overflowing content
christianp commented 1 year ago

I don't know what to do about this: if you ask for four columns, and there isn't enough space for four columns, what should we do?

Putting the choices in columns is really for when you expect to have more than one row of choices. If you set "number of display columns" to 0, then the choices wrap to a new row when needed. Personally, I'd set it to 1 column, so each choice is on its own row.

The padding is not the issue: even without it, the columns can still overflow the page.

chrismgraham commented 1 year ago

Could the columns always collapse to one when the viewport is small (I know that's quite arbitrary!)?

I think this issue came about because it's not obvious there's an issue on a desktop

christianp commented 1 year ago

I've added a horizontal scrollbar to a gap's answer input when it overflows the container. I think this is the safest way of resolving this while satisfying the "number of display columns" constraint". I don't think that switching to one column would be right - a question might have several rows of choices arranged so that you need to know which ones are in the same column. If you're happy for them to be shown on any number of rows, then you should put 0 display columns.