mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 09:33:46 +00:00
feat(a11y): cross-platform hardening + modal focus-trap from impeccable audit
Responsive / viewport: - add .min-h-viewport / .h-viewport utilities (100dvh + Telegram --tg-viewport-stable-height) - migrate min-h-screen / h-screen / 100vh across 18 files - reveal hover-only controls on focus-within + touch (desktop nav, admin settings) - grid breakpoints (TopUpAmount, Contests), larger touch targets, nav aria-labels Platform routing (Telegram WebView correctness): - clipboard -> copyToClipboard util with execCommand fallback (10 files) - window.open -> openTelegramLink / openLink (Profile, Referral, ChannelSubscriptionScreen) - window.confirm -> useNativeDialog (admin pages); PromoOffersSection -> useDestructiveConfirm - window.prompt -> usePrompt / PromptDialogHost (TipTap link editors) - ESLint no-restricted-properties guard against regressions (adapters/clipboard util exempt) Modal accessibility: - new useFocusTrap hook (focus trap, Esc, scroll lock, focus restore) - role=dialog / aria-modal / focus-trap: Polls, SuccessNotificationModal, AdminPolicies, AdminPromoGroups, AdminCampaigns, BroadcastPreview (Telegram + Email) - new global usePrompt store + PromptDialogHost
This commit is contained in:
@@ -10,6 +10,7 @@ import { useNavigate } from 'react-router';
|
||||
import { useSuccessNotification } from '../store/successNotification';
|
||||
import { useCurrency } from '../hooks/useCurrency';
|
||||
import { useTelegramSDK } from '../hooks/useTelegramSDK';
|
||||
import { useFocusTrap } from '../hooks/useFocusTrap';
|
||||
import { useHaptic } from '@/platform';
|
||||
|
||||
// Icons
|
||||
@@ -93,6 +94,9 @@ export default function SuccessNotificationModal() {
|
||||
hide();
|
||||
}, [hide]);
|
||||
|
||||
// Esc + scroll-lock are handled by the effects below; the trap only manages focus.
|
||||
const modalRef = useFocusTrap<HTMLDivElement>(isOpen, { lockScroll: false });
|
||||
|
||||
// Escape key to close
|
||||
useEffect(() => {
|
||||
if (!isOpen) return;
|
||||
@@ -205,6 +209,11 @@ export default function SuccessNotificationModal() {
|
||||
|
||||
{/* Modal */}
|
||||
<div
|
||||
ref={modalRef}
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby="success-modal-title"
|
||||
tabIndex={-1}
|
||||
className="relative mx-4 w-full max-w-sm overflow-hidden rounded-3xl border border-dark-700/50 bg-dark-900 shadow-2xl"
|
||||
style={{
|
||||
marginBottom: safeBottom ? `${safeBottom}px` : undefined,
|
||||
@@ -214,6 +223,7 @@ export default function SuccessNotificationModal() {
|
||||
{/* Close button */}
|
||||
<button
|
||||
onClick={handleClose}
|
||||
aria-label={t('common.close')}
|
||||
className="absolute right-3 top-3 z-10 rounded-xl p-2 text-dark-400 transition-colors hover:bg-dark-800 hover:text-dark-200"
|
||||
>
|
||||
<CloseIcon />
|
||||
@@ -224,7 +234,9 @@ export default function SuccessNotificationModal() {
|
||||
className={`flex flex-col items-center bg-gradient-to-br ${gradientClass} px-6 pb-8 pt-10`}
|
||||
>
|
||||
<div className="mb-4 animate-bounce text-white">{icon}</div>
|
||||
<h2 className="text-center text-2xl font-bold text-white">{title}</h2>
|
||||
<h2 id="success-modal-title" className="text-center text-2xl font-bold text-white">
|
||||
{title}
|
||||
</h2>
|
||||
{message && <p className="mt-2 text-center text-white/80">{message}</p>}
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user