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:
@@ -112,7 +112,12 @@ describe("VideoCard — a title you select", () => {
|
||||
range.selectNodeContents(title);
|
||||
window.getSelection()!.removeAllRanges();
|
||||
window.getSelection()!.addRange(range);
|
||||
const click = new MouseEvent("click", { bubbles: true, cancelable: true, button: 0 });
|
||||
const click = new MouseEvent("click", {
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
button: 0,
|
||||
detail: 1,
|
||||
});
|
||||
title.dispatchEvent(click);
|
||||
expect(onOpen).not.toHaveBeenCalled();
|
||||
expect(click.defaultPrevented).toBe(true);
|
||||
|
||||
Reference in New Issue
Block a user