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

Display the options list better on mobile devices #656

Closed
sturtison opened this issue Jun 30, 2023 · 6 comments
Closed

Display the options list better on mobile devices #656

sturtison opened this issue Jun 30, 2023 · 6 comments

Comments

@sturtison
Copy link
Contributor

All extension options are listed in a table in https://docs.asciidoctor.org/browser-extension/options/#options

The table formatting squashes the middle option description text making it hard to read on mobile devices.

Changing the table formatting to span the option description text over the first two columns would make it more readable on mobile devices.

I could look at this in combination with #652 and #654

@Parth1353
Copy link

Screenshot 2023-10-11 at 1 11 27 AM Are you talking about this?

@mojavelinux
Copy link
Member

It looks like column ratios are needed on the table (e.g., cols=3* or cols=1;2;1) so that the table behaves itself. The automatic layout by the browser is doing a poor job (as it often does).

@ggrossetie
Copy link
Member

Yikes, we definitely need to configure the column ratios 😬

@ggrossetie
Copy link
Member

@mojavelinux do we have a role/style to configure a min-width on a table (and make it scrollable). Below 650px it becomes difficult to read and in my opinion it would be better to add an horizontal scrollbar.

@mojavelinux
Copy link
Member

No, it's not currently possible to add a horizontal scrollbars to tables. In fact, the only way to accomplish it is to use JavaScript to wrap the tables in a scrollable container.

This is something we are discussing in the Antora default UI. See https://gitlab.com/antora/antora-ui-default/-/issues/207

We could add a solution to the Asciidoctor docs UI without having to push it up stream.

Here's the script I currently use for a client's site:

;(function () {
  'use strict'

  find(document.querySelector('article.doc'), 'table.tableblock').forEach(function (table) {
    var parent = table.parentNode
    var maxWidth = parent.getBoundingClientRect().width
    if (table.getBoundingClientRect().width <= maxWidth) return
    var container = Object.assign(document.createElement('div'), { className: 'tablecontainer overflow' })
    table.parentNode.insertBefore(container, table)
    container.appendChild(table)
  })

  function find (from, selector) {
    return [].slice.call(from.querySelectorAll(selector))
  }
})()

@ggrossetie
Copy link
Member

Thanks for the tip!

I think it's good enough now:

image

If someone wants to improve it further, feel free to submit a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants