blur active element on navigation - fixes #287

This commit is contained in:
Rich Harris
2018-06-18 22:44:55 -04:00
parent 47cdc1c4c8
commit 0b43eaa992
2 changed files with 14 additions and 0 deletions

View File

@@ -161,6 +161,7 @@ function navigate(target: Target, id: number) {
}
render(Page, props, scroll_history[id], token);
document.activeElement.blur();
});
}

View File

@@ -608,6 +608,19 @@ function run({ mode, basepath = '' }) {
it('emits a basepath', () => {
assert.equal(captured_basepath, basepath);
});
// skipped because Nightmare doesn't seem to focus the <a> correctly
it.skip('resets the active element after navigation', () => {
return nightmare
.goto(base)
.init()
.click('a[href="about"]')
.wait(100)
.evaluate(() => document.activeElement.nodeName)
.then(name => {
assert.equal(name, 'BODY');
});
});
});
describe('headers', () => {