React useState toggle 的 hover 按鈕在mobile device 無法作用

AI 詠唱出來的第一版, 如果是只有使用 desktop device only, 是沒問題, 且更實用, 但hover 在 mobile device 無法使用.

Changes:

  • State-based Toggle: Replaced the CSS-only group-hover behavior with a React useState toggle. This ensures the dropdown opens and closes reliably on touch screens where hover states are inconsistent.
  • Click-Away Support: Added a transparent backdrop that automatically closes the language menu when you click or tap anywhere else on the screen.
  • Improved Mobile UX: The dropdown now responds immediately to taps, providing a much smoother experience for mobile users.

The language switcher is now fully functional on both desktop and mobile browsers.

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *