mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:27:45 +00:00
LibWeb: Scroll to "nearest" instead of "start" in set_focused_element()
Fixes a bug when after clicking on a button/click the page is scrolled to start of the element.
This commit is contained in:
parent
cda1d886df
commit
f6f80a1a72
1 changed files with 6 additions and 2 deletions
|
@ -1700,8 +1700,12 @@ void Document::set_focused_element(Element* element)
|
||||||
m_layout_root->set_needs_display();
|
m_layout_root->set_needs_display();
|
||||||
|
|
||||||
// Scroll the viewport if necessary to make the newly focused element visible.
|
// Scroll the viewport if necessary to make the newly focused element visible.
|
||||||
if (m_focused_element)
|
if (m_focused_element) {
|
||||||
(void)m_focused_element->scroll_into_view();
|
ScrollIntoViewOptions scroll_options;
|
||||||
|
scroll_options.block = Bindings::ScrollLogicalPosition::Nearest;
|
||||||
|
scroll_options.inline_ = Bindings::ScrollLogicalPosition::Nearest;
|
||||||
|
(void)m_focused_element->scroll_into_view(scroll_options);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Document::set_active_element(Element* element)
|
void Document::set_active_element(Element* element)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue