Files
scrabble-game/ui/src/lib/haptics.ts
T
Ilia Denisov 71c3411276
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Has been skipped
CI / integration (pull_request) Has been skipped
CI / ui (pull_request) Successful in 57s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m13s
fix(ui): mobile in-app WebView polish (tap-flash, VK haptics, swipe-back)
- Tap-highlight: add -webkit-tap-highlight-color: transparent on #app.
  Android in-app WebViews (Telegram, VK) flashed a momentary selection-like
  box on tappable nodes on tap — seen on the header title and the back
  chevron; user-select (already none) does not govern it. Inherited, so
  this clears it app-wide.

- VK haptics: mirror the Telegram haptic set on VK via VK Bridge taptic
  (impact / notification / selection), routed through a new shared
  lib/haptics.ts dispatcher. VK users previously got no haptics; the game
  and error call sites now fire haptic() instead of telegramHaptic().

- VK swipe-back: disable VK's horizontal swipe-back at launch
  (VKWebAppSetSwipeSettings history:false) so it does not fight the app's
  own edge-swipe-back and on-board tile drag — parity with Telegram's
  disabled vertical swipes; the app owns navigation via its back chevron.

Docs: UI_DESIGN (no-select / tap-highlight, VK integration).
2026-06-30 23:00:19 +02:00

17 lines
796 B
TypeScript

// Cross-platform haptic feedback. The app fires one Haptic vocabulary from its interaction code
// (tile placement, submit, errors); this routes it to whichever host Mini App is in play —
// Telegram's HapticFeedback or VK Bridge's taptic events — and stays silent in a plain browser.
import { type Haptic, telegramHaptic } from './telegram';
import { insideVK, vkHaptic } from './vk';
/**
* haptic fires the host Mini App's haptic feedback for kind: Telegram's HapticFeedback inside
* Telegram and VK Bridge's taptic inside VK; a no-op in an ordinary browser. Both backends
* self-guard off their platform, so this is always safe to call. The VK send is fire-and-forget.
*/
export function haptic(kind: Haptic): void {
telegramHaptic(kind);
if (insideVK()) void vkHaptic(kind);
}