Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const goLogin = () => {
</MkDropdownItem>
<!-- 切换账号界面语言 -->
<MkDropdownItem @click.stop class="p-0!">
<MkDropdown class="w-full" trigger="hover" placement="left-start">
<MkDropdown class="w-full" trigger="hover" placement="right-start">
<div class="flex-between w-full gap-2 py-[5px] px-2">
<div class="flex-align-center gap-2">
<MkIcon name="icon_internet_outlined" class="text-N600!" />

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Review of the diff

The change itself is a single token (left-start → right-start) on a nested language submenu. Nothing here is outright broken, but there are several things worth checking.

1. Behavior / correctness

  • RTL regression. right-start is correct for LTR submenus, but this menu exists to switch interface language — so it must also work when dir="rtl" is set (Arabic, Hebrew, etc.). Hardcoding the side means RTL users get a submenu that opens away from the parent item. Derive it from direction:
    :placement="isRTL ? 'left-start' : 'right-start'"
    or use the library's auto/auto-start placement if available.
  • Viewport overflow. A right-opening flyout will be clipped when the parent dropdown is anchored near the right edge (e.g. avatar menu at top-right of the header). Make sure flip/shift modifiers or fallback-placements are enabled; left-start had the symmetric problem on the left, so the real fix is probably "let the popper decide" rather than swapping a constant.
  • trigger="hover" + @click.stop. Clicking the row does nothing (hover opens it), which contradicts the @click.stop handler and normal menu expectations. Also a hover submenu needs:
    • a hover delay / open-close grace period, otherwise diagonal mouse movement from the parent item to the submenu closes it ("diagonal problem");
    • trigger="click" (or ['hover','focus']) for keyboard users.
  • Teleport + outside-click ordering. If poppers are teleported to body, clicking a language option stops propagation to the parent's outside-click handler — verify the parent doesn't close (and cancel the language-change handler) before the selection runs.
  • Chevron/arrow direction. If the row contains a trailing arrow icon, it likely still points left/right incorrectly now. Not visible in the shown lines — check it.
  • Eager rendering. The submenu renders on every dropdown open; consider lazy render on first hover/open if the language list is long.

2. Accessibility

  • Hover-only submenus are unusable on touch devices and for keyboard/AT users. Need role="menu" / role="menuitem", aria-haspopup="menu", aria-expanded, and ArrowRight/Enter to open, ArrowLeft/Escape to close back to the parent item.
  • trigger="hover" typically never updates aria-expanded, so screen readers get no state feedback.

3. Styling / Tailwind

  • py-[5px] breaks the 4px spacing rhythm — use py-1 (4px) or py-1.5 (6px).
  • p-0! and text-N600! (! important) signal specificity conflicts with the component's defaults. Prefer fixing the component defaults or using a proper prop over !important.
  • class="w-full" on the dropdown trigger is fine; if the class lands on the popper it will force a 100%-width panel and can overflow. Verify which element receives it.
  • w-full on a trigger inside a popper resolves against the popper width, not the menu — fine here, but combined with p-0! on the parent item this is a fragile style coupling. A dedicated submenu/nested prop on MkDropdownItem would be cleaner.
  • No gap/offset between parent item and submenu; the flyout may visually butt against the menu. Add a small offset (e.g. :offset="[0, 4]").

4. Minor / verification

  • The hunk header shows const goLogin = () => { but the content is an SFC template with <!-- --> comments — git's enclosing-block heuristic is probably wrong here. Double-check the file/line you're patching (a .vue template can't live inside a JS function).
  • Changing one attribute silently fixes a layout bug; add a comment or a placement prop with a sensible default so the next person doesn't flip it back.
  • No test/Storybook coverage for narrow viewports; a long right-opening language flyout on mobile will exceed the viewport — consider max-height + scroll, or a select/drawer on small screens.

Suggested shape

<MkDropdownItem @click.stop class="!p-0">
  <MkDropdown
    class="w-full"
    trigger="click"
    :placement="isRTL ? 'left-start' : 'right-start'"
    :fallback-placements="['right-start','left-start','right-end','left-end']"
    :offset="[0, 4]"
    @click.stop
  >
    <!-- label + icon; flip the chevron with the placement -->
  </MkDropdown>
</MkDropdownItem>

(Exact prop names for fallback/offset depend on your popper wrapper.)

Bottom line: the one-line change is probably an improvement, but it should be direction-aware, should not rely on hover alone, and should let the popper flip/shift instead of hardcoding a side.

Expand Down
2 changes: 1 addition & 1 deletion ui/src/locales/en-US/common/auth.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
},
"login": {
"label": "Log in",
"now": "Log in now",
"now": "Log in",
"description": "Other login methods",
"sdkLoadFailed": "Login SDK failed to load: {source}"
},
Expand Down
Loading