Skip to content

[feat]: Dynamic Close Button Placement Based on Text Direction (dir)Β #7978

@hawarhekmat

Description

@hawarhekmat

Feature description


πŸ“Œ Feature Request: Dynamic Close Button Placement Based on Text Direction (dir)

🧩 Problem

Currently, the close button in the Sheet component (and possibly other components like Dialog or Drawer) is always placed in a fixed position, regardless of the text direction (dir).

This causes a misaligned UX for users of RTL languages (e.g., Arabic, Kurdish), where the close button still appears on the right side, which is unintuitive in an RTL layout.


βœ… Expected Behavior

The close button should adapt its position dynamically based on the dir attribute of the document or component:

  • dir="ltr" β†’ Close button on the right
  • dir="rtl" β†’ Close button on the left

This behavior should be consistent across all components that include close buttons for a better internationalization (i18n) experience.


πŸ’‘ Suggested Implementation

  • Use the dir attribute (either on html or the nearest parent container) to determine the button placement.
  • Alternatively, conditionally apply Tailwind utility classes like left-0 / right-0 based on dir.
  • This logic could be extracted into a shared utility or hook to standardize behavior across components.

🌍 Why It Matters

Supporting RTL layouts improves accessibility and provides a more intuitive interface for users of RTL languages. This change aligns with modern i18n standards and enhances the overall polish of the UI.


Affected component/components

No response

Additional Context

Additional details here...

Before submitting

  • I've made research efforts and searched the documentation
  • I've searched for existing issues and PRs

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions