Improve accessibility and touch support in dashboard

Enhances accessibility and usability for touch devices and Chromebooks by updating global styles, adding ARIA attributes, and optimizing component layouts. Introduces a new useIsTouchDevice hook, improves focus states, and increases viewport scalability. ChatDetail now supports better keyboard navigation and larger touch targets.
This commit is contained in:
NotII
2025-10-22 17:53:30 +01:00
parent bfc60012cf
commit 1fc29e6cbf
8 changed files with 205 additions and 21 deletions

View File

@@ -17,3 +17,25 @@ export function useIsMobile() {
return !!isMobile
}
export function useIsTouchDevice() {
const [isTouch, setIsTouch] = React.useState<boolean | undefined>(undefined)
React.useEffect(() => {
const checkTouch = () => {
const hasTouch = 'ontouchstart' in window || navigator.maxTouchPoints > 0
setIsTouch(hasTouch)
}
checkTouch()
// Listen for changes in touch capability
const mediaQuery = window.matchMedia('(pointer: coarse)')
const handleChange = () => checkTouch()
mediaQuery.addEventListener('change', handleChange)
return () => mediaQuery.removeEventListener('change', handleChange)
}, [])
return !!isTouch
}