Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -688,18 +688,28 @@ The chevrons, drive, server, lock, speaker and scissors icons are [Lucide](https

## Larger targets

Back, Forward and Up take clicks over 44 × 44 px, and the eject, stop and close buttons over
44 px across their row, however small their icons. For everything else at least 44 px each
way, for a pointer that's hard to aim or a touch screen, put this in
By default, these targets are at least 44 px:

- Back, Forward and Up, 44 × 44 px;
- the eject, stop and close buttons, 44 px across their row, however small their icons;
- dialog buttons, 44 px tall and at least 44 px wide, and the buttons in the Open, Save and
Open With windows' bottom bars;
- menu items and the folders or servers suggested under the path bar, 44 px tall. A menu or
list of suggestions taller than the window scrolls, with an arrow at each edge it goes on
past.

Other controls, such as the list's and sidebar's rows, column headings, crumbs, fields and
checkboxes, keep their denser sizes. For those at least 44 px each way too, for a pointer
that's hard to aim or a touch screen, put this in
`$XDG_CONFIG_HOME/gannet/config.toml` (usually `~/.config/gannet/config.toml`):

```toml
targets = "large"
```

Rows in the list and the sidebar, column headings, crumbs, menu items, notices and buttons
then grow to at least 44 px, while text and icons stay the size they were. Without it, the
list stays dense. Gannet sees the file change while it's open. Upper or lower case doesn't
Rows in the list and the sidebar, column headings, crumbs, notices, fields, checkboxes and the
other buttons then grow to at least 44 px, while text and icons stay the size they were.
Without it, the list stays dense. Gannet sees the file change while it's open. Upper or lower case doesn't
matter; any other value, or no file, is the default.

## Screen readers
Expand Down
19 changes: 11 additions & 8 deletions crates/app/src/a11y.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1082,12 +1082,13 @@ pub struct CaretLine {
/// the item picked, or the menu while none is, as when the pointer opened it.
fn menu(app: &App) -> Option<(Vec<Node>, Modal, u64)> {
let m = app.menu.as_ref()?;
let r = app.menu_rect(m);
let (row, top) = (app.menu_row_h(m.items.len()), r.y + app.px(spacing::SPACE_4));
let (r, sc) = (app.menu_rect(m), app.menu_scroller(m));
let items: Vec<Node> = m.items.iter().enumerate().map(|(i, item)| {
let rect = Rect::new(r.x + app.px(spacing::SPACE_4), top + i as i32 * row, r.w - app.px(spacing::SPACE_8), row);
// The shortcut is said after the name, as it's drawn after it.
Node::new(MENU_ITEM0 + i as u64, Role::MenuItem, item.label, rect, MENU).described(item.keys).enabled(item.enabled).selected(i == m.at && item.enabled).doing(click("Choose it", ""))
let at = sc.item(i);
let rect = Rect::new(r.x + app.px(spacing::SPACE_4), at.y, r.w - app.px(spacing::SPACE_8), at.h);
// The shortcut is said after the name, as it's drawn after it. An item a long menu
// has scrolled out of view keeps where it would be, and isn't showing.
Node::new(MENU_ITEM0 + i as u64, Role::MenuItem, item.label, rect, MENU).described(item.keys).enabled(item.enabled).selected(i == m.at && item.enabled).showing(sc.shows(i)).doing(click("Choose it", ""))
})
.collect();
let picked = m.items.get(m.at).filter(|i| i.enabled).map_or(MENU, |_| MENU_ITEM0 + m.at as u64);
Expand Down Expand Up @@ -1315,13 +1316,15 @@ fn sidebar(app: &App, l: &Layout, mut places: Vec<Node>) -> (Vec<u64>, Vec<Node>
/// each one in it, with the one picked by Up, Down or Tab selected. Picking one puts it in the
/// field, which is what a screen reader hears; the list says what else there is.
fn suggestions(app: &mut App) -> Vec<Node> {
let Some((r, row)) = app.suggestions_rect() else { return Vec::new() };
let Some((r, _)) = app.suggestions_rect() else { return Vec::new() };
let Some(sc) = app.suggest_scroller() else { return Vec::new() };
let Some(s) = app.suggest.as_ref() else { return Vec::new() };
let action = if s.folders { "Go to it" } else { "Connect to it" };
// One scrolled out of view keeps where it would be, and isn't showing.
let items: Vec<Node> = (0..s.items.len())
.map(|i| {
let rect = Rect::new(r.x, r.y + app.px(spacing::SPACE_4) + i as i32 * row, r.w, row);
Node::new(SUGGESTION0 + i as u64, Role::ListItem, s.label(i).to_string(), rect, SUGGESTIONS).selected(s.at == Some(i)).showing(rect.bottom() <= r.bottom()).doing(click(action, ""))
let rect = sc.item(i);
Node::new(SUGGESTION0 + i as u64, Role::ListItem, s.label(i).to_string(), rect, SUGGESTIONS).selected(s.at == Some(i)).showing(sc.shows(i)).doing(click(action, ""))
})
.collect();
let list = if s.folders {
Expand Down
Loading
Loading