Skip to content

Fix checklist bug #2632

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Mohamed-Nagdy
Copy link

PR Template - RTL Checkbox Click Area Fix

Title

Fix RTL checkbox click area issue

Description

This PR fixes a critical issue with checkbox click areas in RTL (Right-to-Left) text direction mode. Previously, when using RTL text direction, checkboxes were visually positioned correctly on the right side but remained clickable only in their original LTR position on the left side, creating a confusing user experience.

Current behavior: In RTL mode, checkboxes appear on the right but can only be clicked on the left side where they would be in LTR mode.

New behavior: In RTL mode, checkboxes are both visually positioned and clickable on the right side, matching user expectations.

Motivation: This fix ensures consistent and intuitive checkbox interaction across different text directions, particularly important for Arabic, Hebrew, and other RTL languages.

Related Issues

No specific GitHub issue was referenced, but this addresses a user-reported bug regarding RTL checkbox interaction.

Type of Change

  • Feature: New functionality without breaking existing features.
  • 🛠️ Bug fix: Resolves an issue without altering current behavior.
  • 🧹 Refactor: Code reorganization, no behavior change.
  • Breaking: Alters existing functionality and requires updates.
  • 🧪 Tests: New or modified tests
  • 📝 Documentation: Updates or additions to documentation.
  • 🗑️ Chore: Routine tasks, or maintenance.
  • Build configuration change: Build/configuration changes.

Technical Details

Files Modified:

  1. lib/src/editor/widgets/text/text_line.dart - Fixed hitTestChildren() method
  2. CHANGELOG.md - Added entry under [Unreleased] section

Root Cause:

In text_line.dart, the paint() method correctly positioned checkboxes for RTL text direction, but the hitTestChildren() method continued to use the original LTR offset for hit testing, causing a mismatch between visual position and clickable area.

Solution:

Modified the hitTestChildren() method to apply the same RTL positioning logic as the paint() method:

// Use the same offset calculation as in paint() method for RTL support
final leadingOffset = textDirection == TextDirection.ltr
    ? childParentData.offset
    : Offset(
        size.width - _leading!.size.width,
        childParentData.offset.dy,
      );

Testing:

  • Static analysis passed (flutter analyze)
  • Manual testing with RTL text direction confirmed the fix
  • No impact on LTR text direction functionality

CHANGELOG Entry Added:

## [Unreleased]

### Fixed

- **RTL checkbox click area issue** fixed where checkboxes in RTL text direction were visually positioned correctly but remained clickable only in their LTR position.

Copy-Paste Ready Sections:

For PR Title:

Fix RTL checkbox click area issue

For PR Description:

This PR fixes a critical issue with checkbox click areas in RTL (Right-to-Left) text direction mode. Previously, when using RTL text direction, checkboxes were visually positioned correctly on the right side but remained clickable only in their original LTR position on the left side, creating a confusing user experience.

**Current behavior:** In RTL mode, checkboxes appear on the right but can only be clicked on the left side where they would be in LTR mode.

**New behavior:** In RTL mode, checkboxes are both visually positioned and clickable on the right side, matching user expectations.

**Motivation:** This fix ensures consistent and intuitive checkbox interaction across different text directions, particularly important for Arabic, Hebrew, and other RTL languages.

For Type of Change (mark Bug fix):

- [x] 🛠️ **Bug fix:** Resolves an issue without altering current behavior.

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