Skip to content

Commit 5bcf182

Browse files
committed
fix: chatlistitemdropdown mobile move menu to the left
1 parent 9576999 commit 5bcf182

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

app/components/Chat/ChatList/ChatListItemDropdown.vue

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,26 @@ function toggleDropdown() {
2828
}
2929
}
3030
31+
const isMobile = computed(() => {
32+
return window.innerWidth <= 448; // Tailwind's sm breakpoint
33+
});
3134
function setDropdownPosition() {
3235
if (dropdownTrigger.value) {
3336
const rect = dropdownTrigger.value.getBoundingClientRect();
37+
const menuWidth = 100; // Approximate width in px, adjust as needed
38+
39+
const top = rect.bottom;
40+
let left = rect.left;
41+
42+
if (isMobile.value) {
43+
// Show to the left of the button
44+
left = Math.max(8, rect.right - menuWidth); // 8px padding from edge
45+
}
46+
3447
dropdownStyle.value = {
3548
position: "fixed",
36-
top: `${rect.bottom}px`,
37-
left: `${rect.left}px`,
49+
top: `${top}px`,
50+
left: `${left}px`,
3851
zIndex: "9999",
3952
};
4053
}
@@ -78,7 +91,7 @@ const chatStore = useChatStore();
7891
class="flex items-center cursor-pointer"
7992
:class="{
8093
'opacity-0': !props.isHovered && !dropdownVisible,
81-
'opacity-100': props.isHovered || dropdownVisible,
94+
'opacity-100': props.isHovered || dropdownVisible || isMobile,
8295
}"
8396
@mousedown.prevent.stop="toggleDropdown"
8497
@dblclick.prevent.stop

0 commit comments

Comments
 (0)