Skip to content

[QF-4753] feat: add 3-dots word hover actions in Arabic reading mode#3156

Open
yousefdergham wants to merge 3 commits intotestingfrom
QF-4753-three-dots
Open

[QF-4753] feat: add 3-dots word hover actions in Arabic reading mode#3156
yousefdergham wants to merge 3 commits intotestingfrom
QF-4753-three-dots

Conversation

@yousefdergham
Copy link
Collaborator

@yousefdergham yousefdergham commented Feb 17, 2026

Summary

  • Adds a 3-dots overflow menu when hovering or tapping words in Arabic reading mode

  • The menu provides three actions:

    • More → opens study mode
    • Play from Word → starts audio from the selected word
    • Repeat Verse → opens the repeat audio modal
  • When translation/transliteration tooltips are enabled, the 3-dots button appears alongside the tooltip

  • When tooltips are disabled, only the 3-dots button appears

  • Layout renders consistently in both LTR and RTL locales

Closes: QF-4753

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)

Scope Confirmation

  • This PR addresses one feature/fix only
  • If multiple changes were needed, they are split into separate PRs

Rollback Safety

  • Can be safely reverted without data issues or migrations

Test Plan

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed

Testing steps:

  1. Open Arabic reading mode with translation tooltip enabled
  2. Hover a word — verify 3-dots appears next to the tooltip with arrow icon after text
  3. Click the tooltip text — verify study mode opens
  4. Click the 3-dots — verify dropdown opens with "More", "Play from Word", and "Repeat Verse"
  5. Click each dropdown action — verify the tooltip and dropdown close after the action
  6. Re-hover the same word — verify the tooltip reappears normally
  7. Disable translation/transliteration — hover a word — verify only the 3-dots appears
  8. Switch to an RTL locale — verify the layout matches LTR (no flipping)
  9. On mobile, tap a word — verify the same overlay appears via popover
  10. Switch to translation/verse-by-verse mode — verify no regressions to existing tooltip behavior

Edge Cases Verified

  • Loading state handled
  • Error state handled
  • Empty state handled
  • Logged-in vs guest behavior (if applicable)

Pre-Review Checklist

Code Quality

  • I have performed a self-review of my code (file by file)
  • My code follows the project style guidelines
  • No any types used (or justified if unavoidable)
  • No unused code, imports, or dead code included
  • Complex logic has inline comments explaining "why"
  • Functions are under 30 lines and follow single responsibility

Testing & Validation

  • All tests pass locally (yarn test)
  • Linting passes (yarn lint)
  • Build succeeds (yarn build)
  • Edge cases and error scenarios are handled

Documentation

  • Code is self-documenting with clear naming
  • README updated (if adding features or setup changes)
  • Inline comments added for complex logic

Localization (if UI changes)

  • All user-facing text uses next-translate
  • Only English locale files modified (Lokalise handles others)
  • RTL layout verified

Accessibility (if UI changes)

  • Semantic HTML elements used
  • ARIA attributes added where needed
  • Keyboard navigation works

Screenshots/Videos

Light Mode Sepia
image image

Reviewer Notes

  • PopoverMenu gained an optional dir prop to override page direction for Radix positioning, used only by the new WordOptionsDropdown.

AI Assistance Disclosure

  • AI tools were NOT used for this PR
  • AI tools were used, and I have thoroughly reviewed and validated all generated code

- Introduced a new feature to play audio from a specific word in the Quran.
- Added a suffix content option to tooltips and popovers for improved user interaction.
- Updated the QuranWord component to handle play actions and integrate new hover actions for reading mode.
- Enhanced styling for tooltips and popovers to support new features and improve layout consistency.
- Refactored related components to accommodate the new functionality and maintain code clarity.
@yousefdergham yousefdergham self-assigned this Feb 17, 2026
Copilot AI review requested due to automatic review settings February 17, 2026 11:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a 3-dots overflow menu feature for word interactions in Arabic reading mode, providing quick access to study mode, play from word, and repeat verse functionality. The implementation extends the existing tooltip/popover infrastructure to support suffix content and handles both LTR and RTL layouts.

Changes:

  • Added a new 3-dots overflow menu in Arabic reading mode that appears on word hover/tap with three actions: More (study mode), Play from Word, and Repeat Verse
  • Extended Tooltip and Popover components with suffixContent prop to support rendering additional UI elements alongside tooltips
  • Created new playFromWord utility function to handle audio playback starting from a selected word

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
src/components/dls/Tooltip/index.tsx Refactored to support suffixContent prop, extracted event handlers, wrapped content in Portal
src/components/dls/Tooltip/Tooltip.module.scss Added contentWithPrefix class and forced LTR direction for consistent layout
src/components/dls/QuranWord/playFromWord.ts New utility function managing audio playback from specific word positions with state tracking
src/components/dls/QuranWord/ReadingModeWordHoverActions/index.tsx New component orchestrating the word hover actions UI and modal interactions
src/components/dls/QuranWord/ReadingModeWordHoverActions/WordOptionsDropdown.tsx New component rendering the 3-dots dropdown menu with action items
src/components/dls/QuranWord/ReadingModeWordHoverActions/ReadingModeWordHoverActions.module.scss Styles for the 3-dots button, dropdown menu, and menu items
src/components/dls/QuranWord/QuranWord.tsx Integrated ReadingModeWordHoverActions for Arabic reading mode, updated import path for ArrowIcon
src/components/dls/PopoverMenu/PopoverMenu.tsx Added optional dir prop for controlling text direction, refactored handleOpenChange logic
src/components/dls/Popover/index.tsx Extended to support suffixContent prop for additional UI elements
src/components/dls/Popover/Popover.module.scss Added contentWithPrefix class, changed responsive margin behavior
src/components/dls/Popover/HoverablePopover/index.tsx Added state management for popover open state and tooltip suppression logic
locales/en/quran-reader.json Added "play-from-word" translation key

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 05892509f6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

- Added a cleanup function to ensure proper unsubscription from audio service.
- Refactored the subscription handling to utilize the cleanup function for better code clarity and maintainability.
- Enhanced the playFromWord function to check for verse timings before seeking, preventing potential errors.
- Simplified the rendering logic for tooltip content by consolidating the conditional structure.
- Ensured consistent class naming for tooltip content based on the presence of suffix content.
- Improved code clarity and maintainability in the Tooltip component.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant