canonical / canonical/vanilla-framework

Table of contents: mobile, other improvements

Open
#4,777 2 comments 0 reactions 2 assignees Claimed by @danielmutis View on GitHub
Review: Design needed Vanilla WG WG: Validated
Dominant language
HTML
Stars
983
Forks
216
Avg merge
3d 13h
Merged PRs (30d)
3

Description

## Pattern to amend

[Table of contents](https://vanillaframework.io/docs/patterns/table-of-contents)

## Context

The is some tweaks we could apply to the table of contents on mobile:

- The table of contents looks rather misaligned due to x-padding.
- When placed in a column on the right on desktop, it shows up after the main content on mobile, becoming unaccessible. We could place it above the content, but in some cases there might be many links. Should we consider another toggle for this? How would it play with the sidebar toggle?
- Touch surface for links seems small.

Beyond mobile:

- When a link label wraps, it looks like two different links. Some margin beyond line height could work.
- In most cases, the heading should be a H2. When that's the case, it inherits weight 100, it really looks too thin. It wouldn't pass the [APCA test](https://contrast.tools?text=666666&background=ffffff) (WIP).

## Visual

How it is:

![vanillaframework io_docs_examples_patterns_table-of-contents](https://github.com/canonical/vanilla-framework/assets/1409729/22d6f7da-e6f9-421d-a409-c9383c97253a)

Some initial style suggestions:

![vanillaframework io_docs_examples_patterns_table-of-contents (1)](https://github.com/canonical/vanilla-framework/assets/1409729/96a3cff7-288c-4c3a-b981-118dd10b7e65)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.