fix(ui): Enter on a selectable title opens it even with its words selected

endsTextSelection takes the click event and exempts a keyboard click (detail 0): Enter / Space
ends no selection, so a title selected and then tabbed to opened nothing. All three callers
(FocusSafeButton, the Plex caption, the video card title) go through it.
This commit is contained in:
2026-09-27 14:55:50 +02:00
parent 52c15adaf2
commit 0b1d905866
7 changed files with 34 additions and 14 deletions
@@ -306,10 +306,10 @@ describe("a Plex card's title stays selectable", () => {
range.selectNodeContents(title);
window.getSelection()!.removeAllRanges();
window.getSelection()!.addRange(range);
fireEvent.click(title);
fireEvent.click(title, { detail: 1 });
expect(onOpen).not.toHaveBeenCalled();
window.getSelection()!.removeAllRanges();
fireEvent.click(title);
fireEvent.click(title, { detail: 1 });
expect(onOpen).toHaveBeenCalledTimes(1);
});
});