Fix leads filter popover anchoring under the button in RTL.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -301,12 +301,12 @@ function toggleFilterSection(name: NonNullable<typeof filterSection.value>) {
|
|||||||
|
|
||||||
const filterAnchor = ref<HTMLElement | null>(null);
|
const filterAnchor = ref<HTMLElement | null>(null);
|
||||||
const filterPopoverMaxHeight = ref('min(70vh, 32rem)');
|
const filterPopoverMaxHeight = ref('min(70vh, 32rem)');
|
||||||
const filterPanelPos = ref({ top: 0, inlineEnd: 8 });
|
const filterPanelPos = ref({ top: 0, left: 8 });
|
||||||
|
|
||||||
const filterPanelStyle = computed(() => ({
|
const filterPanelStyle = computed(() => ({
|
||||||
position: 'fixed' as const,
|
position: 'fixed' as const,
|
||||||
top: `${filterPanelPos.value.top}px`,
|
top: `${filterPanelPos.value.top}px`,
|
||||||
insetInlineEnd: `${filterPanelPos.value.inlineEnd}px`,
|
left: `${filterPanelPos.value.left}px`,
|
||||||
zIndex: 1050,
|
zIndex: 1050,
|
||||||
width: 'min(20rem, calc(100vw - 1.5rem))',
|
width: 'min(20rem, calc(100vw - 1.5rem))',
|
||||||
maxHeight: filterPopoverMaxHeight.value,
|
maxHeight: filterPopoverMaxHeight.value,
|
||||||
@@ -323,9 +323,15 @@ function placeFilterPopover() {
|
|||||||
const rect = el.getBoundingClientRect();
|
const rect = el.getBoundingClientRect();
|
||||||
const space = Math.floor(window.innerHeight - rect.bottom - 12);
|
const space = Math.floor(window.innerHeight - rect.bottom - 12);
|
||||||
filterPopoverMaxHeight.value = `${Math.max(220, space)}px`;
|
filterPopoverMaxHeight.value = `${Math.max(220, space)}px`;
|
||||||
|
// همان رفتار absolute با inset-inline-end:0 (RTL): لبهٔ چپ پنل = لبهٔ چپ دکمه
|
||||||
|
const panelW = Math.min(20 * 16, window.innerWidth - 24);
|
||||||
|
let left = rect.left;
|
||||||
|
if (left + panelW > window.innerWidth - 8) {
|
||||||
|
left = window.innerWidth - panelW - 8;
|
||||||
|
}
|
||||||
filterPanelPos.value = {
|
filterPanelPos.value = {
|
||||||
top: rect.bottom + 6,
|
top: rect.bottom + 6,
|
||||||
inlineEnd: Math.max(8, Math.round(window.innerWidth - rect.right)),
|
left: Math.max(8, Math.round(left)),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user