Elvira Khabirova 87f7b1d8a6 Always focus on the window when there is no selection
Selection.rangeCount can return 1 when there is no selection,
it is enough for a selection to have been present in the past
or for the user to have clicked on the page.

See MDN: https://developer.mozilla.org/en-US/docs/Web/API/Selection/rangeCount

Use Selection.isCollapsed to be entirely sure there is a selection
before ignoring the click.

This change fixes the issue ish-app/ish#2519, where focus to the terminal
is lost and can not be regained, forcing the user to restart ish.

Tested on iPad Pro 13-inch (M4) with iPadOS 26 Beta 2 and Stage Manager.

Signed-off-by: Elvira Khabirova <lineprinter0@gmail.com>
2025-06-29 11:00:31 +02:00
..
2024-02-25 20:05:59 -08:00
2023-11-20 17:24:11 +01:00
2023-04-22 21:59:20 -07:00
2021-06-23 04:34:10 -07:00
2018-12-27 18:45:03 -08:00
2022-10-30 18:06:04 -07:00
2024-01-08 10:23:39 -08:00
2024-01-08 10:23:39 -08:00
2017-11-08 17:25:04 -08:00
2019-10-26 12:58:21 -07:00
2019-10-26 12:58:21 -07:00
2024-01-08 10:23:39 -08:00
2022-02-20 17:15:07 -08:00
2023-10-29 09:30:30 -07:00
2023-10-29 09:30:30 -07:00
2020-12-06 01:09:23 -08:00
2024-01-08 10:23:39 -08:00
2022-02-14 00:42:58 -08:00
2022-02-14 00:42:58 -08:00
2022-02-14 00:42:58 -08:00
2022-02-14 00:42:58 -08:00
2019-10-20 20:48:29 -07:00
2019-10-20 20:48:29 -07:00
2023-05-06 02:17:01 -07:00
2020-11-28 19:58:14 -08:00
2020-11-28 19:58:14 -08:00
2020-11-28 19:58:14 -08:00
2019-09-06 23:30:41 -07:00
2021-08-15 00:34:53 -07:00
2024-11-09 14:42:32 -08:00
2024-11-09 14:42:32 -08:00
2021-12-31 20:49:52 -08:00
2023-06-02 18:29:07 -07:00
2022-08-23 18:16:34 -07:00
2022-10-30 18:06:04 -07:00