Skip to content

Commit dd8646a

Browse files
authored
fix(react): hydrate search on idle for keyboard shortcuts (#1062)
1 parent aac7ef7 commit dd8646a

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎packages/react/src/html/__tests__/generate.test.mjs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ const createTestConfiguration = async (context, target = ['html']) => {
7272

7373
describe('web generate', () => {
7474
it('writes bundled HTML and omits View As links for synthetic pages', async context => {
75-
const { output } = await createTestConfiguration(context);
75+
const { config, output } = await createTestConfiguration(context);
76+
config.html.showSearchBox = true;
7677
const fs = createEntry('fs', 'File system');
7778
fs.path = '/api/fs';
7879
const notFoundPage = buildNotFoundPage();
@@ -94,6 +95,7 @@ describe('web generate', () => {
9495
assert.doesNotMatch(notFoundHTML, /View As/);
9596
assert.match(fsHTML, /src=\.\.\/assets\//);
9697
assert.match(notFoundHTML, /src=\.\/assets\//);
98+
assert.match(fsHTML, /on:idle[^>]*data-island-name=SearchBox/);
9799
});
98100

99101
it('renders chunk pages with navigation back to their module', async context => {

‎packages/react/src/html/ui/components/SearchBox/index.jsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,5 @@ const SearchBox = ({ pathname }) => {
100100

101101
export default withIsland(SearchBox, {
102102
name: 'SearchBox',
103-
on: { interaction: 'pointerover,focusin,touchstart' },
103+
on: { idle: true },
104104
});

0 commit comments

Comments
 (0)