mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-01 01:08:48 -04:00
Preserve focused element on pop
This commit is contained in:
@@ -35,8 +35,13 @@ Document::~Document() {
|
||||
|
||||
void Document::show() {
|
||||
if (mDocument != nullptr) {
|
||||
mDocument->Show();
|
||||
focus();
|
||||
// Attempt to preserve the previously focused element
|
||||
mDocument->Show(Rml::ModalFlag::None, Rml::FocusFlag::Keep);
|
||||
// If nothing is focused, let the document decide the initial focus
|
||||
auto* leaf = mDocument->GetFocusLeafNode();
|
||||
if (leaf == nullptr || leaf == mDocument) {
|
||||
focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user