fix: apply the review items for #689 at merge

Clamp the stored toolbar width to MIN_WIDTH in apply() and step the arrow keys from the width on screen, so a drag to the window edge or a held ArrowRight no longer stores a negative width or leaves an ArrowLeft dead zone (browser test added)
Drop Escape as a reset key on the handle: the global capture-phase Escape handler already closes every panel on it (static pin added)
Say in the changeset, the wiki and the densityFor comment that the percentages go at the narrowest step in the Compact style only, and drop Escape from the changeset

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer committed 2026-10-24 14:08:37 +02:00
1 parent f3c90abeb0
commit 34a2966c19
5 files changed
+34 -9

No files matched your search

+6 -5
View File
@@ -23,8 +23,8 @@
/**
* How much of the usage readings to show for a toolbar this wide. The narrower the toolbar, the more of
* the labels go: window labels first, then provider names (shortened), then the percentages (the rings
* stay, and the chip's tooltip keeps the numbers).
* the labels go: window labels first, then provider names (shortened), then, in the Compact style, the
* percentages (the rings stay, and the chip's tooltip keeps the numbers).
*/
function densityFor(width) {
if (width >= 560) return '';
@@ -134,7 +134,7 @@
}
function apply(width) {
wanted = width === null ? null : Math.round(width);
wanted = width === null ? null : Math.max(MIN_WIDTH, Math.round(width));
writeStored(wanted);
settle();
relayout();
@@ -188,10 +188,11 @@
handle.addEventListener('dblclick', () => apply(null));
handle.addEventListener('keydown', (event) => {
if (event.key === 'Home' || event.key === 'Escape') {
if (event.key === 'Home') {
apply(null);
} else if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') {
apply((wanted ?? current()) + (event.key === 'ArrowLeft' ? KEY_STEP : -KEY_STEP));
// Step from the width on screen, not the request, so a key held past the floor never leaves a dead zone.
apply(current() + (event.key === 'ArrowLeft' ? KEY_STEP : -KEY_STEP));
} else {
return;
}