paranext / paranext-core

Electron client, extension host, and C# library for Paranext
https://paranext.github.io/paranext-core/
MIT License
17 stars 2 forks source link

DropdownMenuItem does not react to the dir property #1050

Open Sebastian-ubs opened 3 months ago

Sebastian-ubs commented 3 months ago

Describe the bug When switching direction to right-to-left, the content of DropdownMenuItem does still align left-to-right, therefore Shortcuts are displayed always to the right. See https://github.com/paranext/paranext-core/blob/fix-direction-for-many-components/lib/platform-bible-react/src/components/shadcn-ui/dropdown-menu.tsx#L129

To Reproduce

  1. Open preview app npm run start in platform-bible-react
  2. Go to basic components
  3. Click Dropdown Menu
  4. Open the dropdown to see its content
  5. Click the "rtl" or "ltr" button in the upper right corner (observe that DropdownMenuItem ⇧⌘P does not change its order)
<span>DropdownMenuItem</span><span class="pr-ml-auto pr-text-xs pr-tracking-widest pr-opacity-60">⇧⌘P</span>

Expected behavior Content will align right-to-left in a right-to-left layout and left-to-right in a left-to-right layout

Sebastian-ubs commented 3 months ago

Somehow it is working in https://github.com/paranext/paranext-core/blob/fix-direction-for-many-components/lib/platform-bible-react/src/preview/components/layouts/window.layout.component.tsx#L98, grafik

but not in https://github.com/paranext/paranext-core/blob/fix-direction-for-many-components/lib/platform-bible-react/src/preview/components/basics/dropdown.examples.component.tsx#L28 🤷 grafik

Sebastian-ubs commented 3 months ago

Also checkbox is at the wrong side for https://github.com/paranext/paranext-core/blob/fix-direction-for-many-components/lib/platform-bible-react/src/components/shadcn-ui/dropdown-menu.tsx#L150 in example code https://github.com/paranext/paranext-core/blob/fix-direction-for-many-components/lib/platform-bible-react/src/preview/components/layouts/dashboard5.layout.component.tsx#L263 grafik

This works well in the combobox grafik