mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-09 16:59:43 +02:00
fix(tiles): a keyboard focus brings the Tiles hover card back after a click
Found live: a click on Tiles hides the card and keeps it hidden while the pointer rests on the button, until the pointer leaves. With the pointer left there, tabbing away and back onto the button showed no card either, so a keyboard user whose mouse happened to sit on the button never got the Shift+F10 hint. Leaving the button (blur) now ends that suppression as well: a keyboard focus that comes back later is a new arrival. A click that opens the grid or a right-click that opens the menu still shows nothing, since no pointerenter or focus follows while the pointer stays. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -605,7 +605,12 @@ Object.assign(CodemanApp.prototype, {
|
|||||||
}
|
}
|
||||||
if (btn.matches?.(':focus-visible')) this._scheduleTileHint({ keyboard: true });
|
if (btn.matches?.(':focus-visible')) this._scheduleTileHint({ keyboard: true });
|
||||||
});
|
});
|
||||||
btn.addEventListener('blur', () => this._hideTileHint());
|
// Leaving the button ends a click's suppression too: a keyboard focus that
|
||||||
|
// comes back later is a new arrival, even with the pointer still on it.
|
||||||
|
btn.addEventListener('blur', () => {
|
||||||
|
hint.suppressed = false;
|
||||||
|
this._hideTileHint();
|
||||||
|
});
|
||||||
// Capture: these run before the button's own handlers, so the card is gone
|
// Capture: these run before the button's own handlers, so the card is gone
|
||||||
// before a right-click opens the count menu or a click opens the grid; and
|
// before a right-click opens the count menu or a click opens the grid; and
|
||||||
// it stays gone while the pointer rests there.
|
// it stays gone while the pointer rests there.
|
||||||
|
|||||||
@@ -281,6 +281,18 @@ describe('hiding', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('a keyboard focus coming back after a click shows it, the pointer still resting there', () => {
|
||||||
|
shown();
|
||||||
|
btn.dispatch('click', {});
|
||||||
|
expect(card()!.hidden).toBe(true);
|
||||||
|
// Tab away and back, the mouse never moved.
|
||||||
|
btn.dispatch('blur', {});
|
||||||
|
(btn as unknown as { matches: (s: string) => boolean }).matches = (s) => s === ':focus-visible';
|
||||||
|
btn.dispatch('focus', {});
|
||||||
|
vi.advanceTimersByTime(300);
|
||||||
|
expect(card()!.hidden).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
it('the count menu never opens beside it: openTileCountMenu hides it first', () => {
|
it('the count menu never opens beside it: openTileCountMenu hides it first', () => {
|
||||||
const app = shown();
|
const app = shown();
|
||||||
app.openTileCountMenu({ preventDefault: vi.fn() });
|
app.openTileCountMenu({ preventDefault: vi.fn() });
|
||||||
|
|||||||
Reference in New Issue
Block a user