fix: reset capture viewport after keyboard navigation
This commit is contained in:
parent
89c25369fc
commit
58299311d0
|
|
@ -53,6 +53,8 @@ function createIssueModalLifecycle({ root, background = [], document, requestClo
|
|||
active = false;
|
||||
backgroundState.forEach(([element, inert]) => { element.inert = inert; });
|
||||
backgroundState = [];
|
||||
const panel = root.querySelector('.create-issue-panel');
|
||||
if (panel) panel.scrollTop = 0;
|
||||
if (restore && launcher?.isConnected) launcher.focus();
|
||||
launcher = null;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -30,9 +30,11 @@ function element(id) {{
|
|||
const launcher = element('mobile-new');
|
||||
const cancel = element('cancel-new-issue');
|
||||
const title = element('create-issue-title');
|
||||
const panel = {{...element('create-issue-panel'), scrollTop:420}};
|
||||
const background = [element('header'), element('main'), element('mobile-task-dock')];
|
||||
const root = {{
|
||||
querySelector: selector => selector === '#cancel-new-issue' ? cancel : null,
|
||||
querySelector: selector => selector === '#cancel-new-issue' ? cancel :
|
||||
(selector === '.create-issue-panel' ? panel : null),
|
||||
querySelectorAll: () => [cancel, title],
|
||||
addEventListener() {{}}, removeEventListener() {{}},
|
||||
}};
|
||||
|
|
@ -44,14 +46,14 @@ lifecycle.open(launcher);
|
|||
const opened = {{active:document.activeElement.id, inert:background.map(item => item.inert)}};
|
||||
lifecycle.close();
|
||||
process.stdout.write(JSON.stringify({{
|
||||
opened, closed:{{active:document.activeElement.id, inert:background.map(item => item.inert)}}
|
||||
opened, closed:{{active:document.activeElement.id, inert:background.map(item => item.inert), scrollTop:panel.scrollTop}}
|
||||
}}));
|
||||
"""
|
||||
)
|
||||
|
||||
assert result == {
|
||||
"opened": {"active": "cancel-new-issue", "inert": [True, True, True]},
|
||||
"closed": {"active": "mobile-new", "inert": [False, False, False]},
|
||||
"closed": {"active": "mobile-new", "inert": [False, False, False], "scrollTop": 0},
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user