Skip to content

Commit cdda32f

Browse files
feat: update to upstream @floating-ui/[email protected] (#136)
* feat: update to upstream @floating-ui/[email protected] * fix: correct position when document scrollbar is on left side with fixed strategy --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Daniëlle Huisman <[email protected]>
1 parent 486f119 commit cdda32f

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

packages/dom/src/utils/get_rect_relative_to_offset_parent.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ pub fn get_rect_relative_to_offset_parent(
3232
let mut scroll = NodeScroll::new(0.0);
3333
let mut offsets = Coords::new(0.0);
3434

35+
// If the <body> scrollbar appears on the left (e.g. RTL systems).
36+
// Use Firefox with layout.scrollbar.side = 3 in about:config to test this.
37+
let set_left_rtl_scrollbar_offset = |offsets: &mut Coords| {
38+
offsets.x = get_window_scroll_bar_x(&document_element, None);
39+
};
40+
3541
#[allow(clippy::nonminimal_bool)]
3642
if is_offset_parent_an_element || (!is_offset_parent_an_element && !is_fixed) {
3743
if get_node_name((&offset_parent).into()) != "body"
@@ -52,13 +58,15 @@ pub fn get_rect_relative_to_offset_parent(
5258
offsets.y = offset_rect.y + offset_parent.client_top() as f64;
5359
}
5460
DomElementOrWindow::Window(_) => {
55-
// If the <body> scrollbar appears on the left (e.g. RTL systems).
56-
// Use Firefox with layout.scrollbar.side = 3 in about:config to test this.
57-
offsets.x = get_window_scroll_bar_x(&document_element, None);
61+
set_left_rtl_scrollbar_offset(&mut offsets);
5862
}
5963
}
6064
}
6165

66+
if is_fixed && !is_offset_parent_an_element {
67+
set_left_rtl_scrollbar_offset(&mut offsets);
68+
}
69+
6270
let html_offset = if !is_offset_parent_an_element && !is_fixed {
6371
get_html_offset(&document_element, &scroll, None)
6472
} else {

upstream.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[releases]
22
core = "1.7.0"
3-
dom = "1.6.13"
3+
dom = "1.7.0"
44
utils = "0.2.9"
55
vue = "1.1.6"

0 commit comments

Comments
 (0)