fix(KAN-71): use interactive WebKit navigation gestures
CI/CD / preconditions (pull_request) Successful in 1s
Native JavaScript checks / Native launcher and release tests (pull_request) Successful in 1m13s
macOS checks / Native Rust tests and unsigned build (pull_request) Successful in 1m44s
CI/CD / test_and_check_app (pull_request) Successful in 7m4s
CI/CD / Publish immutable image (pull_request) Skipped

This commit is contained in:
2026-09-29 08:02:10 +02:00
parent 386b25858b
commit 1cf7524a7b
16 changed files with 110 additions and 499 deletions
+1 -65
View File
@@ -1,21 +1,8 @@
(() => {
if (window.top !== window || window.__kanbanNavigation) {
if (window.top !== window) {
return;
}
let dragging = false;
const overlay = () =>
[
...document.querySelectorAll(
'dialog[open], [role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [data-reka-popper-content-wrapper]',
),
].some(
(element) =>
element.getAttribute('data-state') !== 'closed' &&
element.getClientRects().length > 0 &&
getComputedStyle(element).visibility !== 'hidden',
);
const constrainScroll = () => {
if (document.documentElement) {
document.documentElement.style.overscrollBehaviorY = 'none';
@@ -28,55 +15,4 @@
document.addEventListener('DOMContentLoaded', constrainScroll, {
once: true,
});
document.addEventListener('dragstart', () => {
dragging = true;
});
document.addEventListener('dragend', () => {
dragging = false;
});
document.addEventListener('drop', () => {
dragging = false;
});
window.__kanbanNavigation = Object.freeze({
canSwipe(x, y) {
if (dragging || overlay()) {
return false;
}
for (
let element = document.elementFromPoint(x, y);
element;
element = element.parentElement
) {
if (
element.matches(
'input, textarea, select, [contenteditable]:not([contenteditable="false"]), [draggable="true"]',
)
) {
return false;
}
const style = getComputedStyle(element);
if (
/(auto|scroll)/.test(style.overflowX) &&
element.scrollWidth > element.clientWidth
) {
return false;
}
if (
style.overscrollBehaviorX === 'contain' ||
style.overscrollBehaviorX === 'none'
) {
return false;
}
}
return true;
},
step(direction) {
// The host checks canGoBack/canGoForward. JS traversal preserves SPA entries
// that WebKit's user-initiated history traversal is allowed to skip.
if (direction === -1 || direction === 1) {
window.history.go(direction);
}
},
});
})();