-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Description
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 rightdir="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 onhtml
or the nearest parent container) to determine the button placement. - Alternatively, conditionally apply Tailwind utility classes like
left-0
/right-0
based ondir
. - 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