mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 05:25:40 +09:00
fix(app): make click-through the default and move animation pausing to Accessibility (#1722)
This commit is contained in:
1 parent
9e89539f0a
commit
4bbfee4cec
19 files changed
+96
-248
No files matched your search
@@ -3,7 +3,6 @@
|
||||
export const WINDOW_FOCUSED_CLASS = 'window-focused';
|
||||
export const WINDOW_FOCUS_ACTIVATION_GUARD_CLASS = 'window-focus-activation-guard';
|
||||
export const UNFOCUSED_FULLY_INTERACTIVE_CLASS = 'unfocused-fully-interactive';
|
||||
export const FIRST_CLICK_PASSTHROUGH_WHEN_UNFOCUSED_CLASS = 'first-click-passthrough-when-unfocused';
|
||||
export const WINDOW_HOVER_CONTROLS_CHANGE_EVENT = 'fluxer-window-hover-controls-change';
|
||||
const DEFAULT_GUARD_TIMEOUT_MS = 250;
|
||||
const DEFAULT_RELEASE_CLEAR_DELAY_MS = 50;
|
||||
@@ -32,16 +31,6 @@ export function isUnfocusedFullyInteractive(root: HTMLElement = document.documen
|
||||
return root.classList.contains(UNFOCUSED_FULLY_INTERACTIVE_CLASS);
|
||||
}
|
||||
|
||||
export function shouldBlockActivationClick(root: HTMLElement = document.documentElement): boolean {
|
||||
return (
|
||||
isWindowFocusActivationGuardActive(root) && !root.classList.contains(FIRST_CLICK_PASSTHROUGH_WHEN_UNFOCUSED_CLASS)
|
||||
);
|
||||
}
|
||||
|
||||
export function canUseWindowFocusedActivationClick(root: HTMLElement = document.documentElement): boolean {
|
||||
return !shouldBlockActivationClick(root);
|
||||
}
|
||||
|
||||
export function canUseWindowFocusedHoverControls(root: HTMLElement = document.documentElement): boolean {
|
||||
if (isUnfocusedFullyInteractive(root)) {
|
||||
return !isWindowFocusActivationGuardActive(root);
|
||||
@@ -132,20 +121,12 @@ export function createWindowFocusInteractionGuard({
|
||||
clearActivationGuard();
|
||||
}, releaseClearDelayMs);
|
||||
};
|
||||
const suppressActivationEvent = (event: Event) => {
|
||||
if (!shouldBlockActivationClick(root)) return;
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
event.stopImmediatePropagation();
|
||||
};
|
||||
const handlePointerStart: EventListener = (event) => {
|
||||
const handlePointerStart: EventListener = () => {
|
||||
if (wasBlurred || !focused || isWindowFocusActivationGuardActive(root)) {
|
||||
beginActivationGuard(true);
|
||||
}
|
||||
suppressActivationEvent(event);
|
||||
};
|
||||
const handlePointerEnd: EventListener = (event) => {
|
||||
suppressActivationEvent(event);
|
||||
const handlePointerEnd: EventListener = () => {
|
||||
scheduleClearAfterActivationClick();
|
||||
};
|
||||
windowTarget.addEventListener('pointerdown', handlePointerStart, true);
|
||||
|
||||
Reference in new issue
Block a user