Jump index

A strip of letters, or of months and years, at the right edge of a long list. Press a mark to jump to that part of the list.

Part of a window with a list of songs and a strip of letters at its right edge, the letter G under the pointer.

Use it for a list long enough that scrolling costs more than a jump: a library of songs, a long folder sorted by name. A short list needs none. The index is a second way in: it never replaces the list's own keys, where typing a name does the same.

Anatomy

Seven marks, E to K, at one and a half times their size: F is faint, G is bright with the pointer on it, H is quiet. Numbered callouts sit beside F, G and H.
A part of the index at 1.5 times its size.
  1. Under the pointerThe mark the pointer is on, or the one a press has reached, in the main ink.
  2. In the listA mark the list has something for, in the secondary ink.
  3. Not in the listA mark the list has nothing for, in the faint ink. It does not react, and a press on it does nothing.

The marks are letters by default. For a list sorted by date they are months and years instead (marks), and present says which of them the list has.

States

The marks G, H and K three times, numbered by what happens to H: it is in the list, it is under the pointer, it is not in the list.
  1. In the listThe secondary ink.
  2. Under the pointerThe main ink. The same while a press is held on it or a slide is passing over it.
  3. Not in the listThe faint ink. The mark is not pressable and the pointer stays an arrow.

Sizes

A jump index at one and a half times its size, five marks, 44 wide, with one step of 28 measured.
A part of the index at 1.5 times its size.
PartValue
Width44
Step28 pixels for each mark, the whole height of a mark's target
Text13 pixels (meta), centred in the step
A full alphabet26 marks, 728 pixels

Anchor the index's top and bottom to the list so it knows the room it has. With less than 728 pixels the step shrinks, down to 18.

Folding

When every mark at 18 pixels no longer fits, the index folds: every other place shows a dot standing for the marks between its neighbours (A, a dot, C, a dot, E, and on to Z). A press or a slide on a dot goes to the first of those marks the list has, and a screen reader hears the dot as the stretch it covers ("D to F"). A folded mark takes 24 pixels around its middle for a press, and the dot between two marks the 12 pixels that are left.

Keys and pointer

The index is not a stop for Tab. Anyone with a keyboard types a name in the list instead.

Do thisTo
Press a markJump to it (jump(mark))
Press and slide along the indexKeep jumping, from mark to mark, as the pointer passes over them
Touch and dragThe same as the slide

Accessibility

Writing

Marks are single letters, or a month or a year. Do not abbreviate a letter into a range ("A-C"): a mark is one place.

Do and don't

A list of five names with its index A to H; A, B, D, G and H are bright and C, E and F faint.
DoKeep every mark in the index. The marks the list lacks go faint and inert, and the rest stay where they always are.
The same list with an index of only A, B, D, G and H.
Don'tTake out the marks the list lacks. The index changes length and each letter moves between lists, so a thumb that learned where G is has to look again.

Code

import Tacit.Kit

Item {
    RowList { id: list; width: 640; height: 400; model: songs; delegate: SongRow {} }
    JumpIndex {
        anchors.right: parent.right
        present: songs.firstLetters()             // the letters the list has
        onJump: mark => list.moveTo(songs.firstIndexOf(mark), "select")
    }
}
Property or signalWhat it does
marksThe marks, in order: the alphabet by default, or months and years
presentThe marks the list has; the rest go faint and inert (all of them by default)
jump(mark)A press, or a slide that has reached a mark the list has. On a dot, the first mark it covers that the list has

Experimental, in Tacit.Kit 0.1.