Skip to content

✨(frontend) add top parent on sub docs search - #1952

Merged
AntoLC merged 4 commits into
mainfrom
refacto/sub-docs-search
Jun 10, 2026
Merged

AntoLC merged 4 commits into
mainfrom
refacto/sub-docs-search

Conversation

@AntoLC

@AntoLC AntoLC commented Mar 6, 2026 •

Copy link
Copy Markdown
Member

Purpose

In the search modal, under the sub docs, we now display the top parent of the doc, to give more context to the user about the doc they are looking for.
We refactorize the filters to get more flexibility and avoid too much props drilling.

Demo

Enregistrement.2026-06-05.111227.mp4

@AntoLC AntoLC self-assigned this Mar 6, 2026
@AntoLC AntoLC linked an issue Mar 6, 2026 that may be closed by this pull request
@AntoLC AntoLC changed the title Refacto/sub docs search ♻️(frontend) Display sub-docs in search results Mar 6, 2026
@github-actions

github-actions Bot commented Mar 6, 2026 •

Copy link
Copy Markdown
Contributor

Size Change: -254 B (-0.01%)

Total Size: 4.33 MB

📦 View Changed
Filename Size Change
apps/impress/out/_next/static/02b0950b/_buildManifest.js 677 B +677 B (new file) 🆕
apps/impress/out/_next/static/chunks/3682.js 0 B -23.2 kB (removed) 🏆
apps/impress/out/_next/static/chunks/5149.js 23 kB +23 kB (new file) 🆕
apps/impress/out/_next/static/fd9c184a/_buildManifest.js 0 B -672 B (removed) 🏆

compressed-size-action

@AntoLC
AntoLC force-pushed the refacto/sub-docs-search branch 2 times, most recently from 0bf9667 to c89909b Compare March 19, 2026 13:24
@AntoLC
AntoLC force-pushed the refacto/sub-docs-search branch from c89909b to d213b2e Compare June 2, 2026 16:33
@AntoLC AntoLC changed the title ♻️(frontend) Display sub-docs in search results ✨(frontend) add top parent on sub docs search Jun 4, 2026
@AntoLC
AntoLC force-pushed the refacto/sub-docs-search branch 2 times, most recently from bab36fd to c93a524 Compare June 5, 2026 09:10
@AntoLC AntoLC added the preview label Jun 5, 2026
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

🚀 Preview will be available at https://1952-docs.ppr-docs.beta.numerique.gouv.fr/

You can use the existing account with these credentials:

  • username: docs
  • password: docs

You can also create a new account if you want to.

Once this Pull Request is merged, the preview will be destroyed.

@AntoLC
AntoLC force-pushed the refacto/sub-docs-search branch 2 times, most recently from 511add0 to 5039cb2 Compare June 5, 2026 13:02
@AntoLC
AntoLC marked this pull request as ready for review June 5, 2026 13:02
@AntoLC
AntoLC force-pushed the refacto/sub-docs-search branch from 5039cb2 to c5974a8 Compare June 5, 2026 15:33
@AntoLC
AntoLC requested a review from Ovgodd June 5, 2026 15:34
@AntoLC
AntoLC force-pushed the refacto/sub-docs-search branch 3 times, most recently from a1df949 to e2caf4f Compare June 9, 2026 07:29

@Ovgodd Ovgodd left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works well on my side, just a few suggestions in terms of accessibility and readability.

}, [search]);

useEffect(() => {
setFilter(defaultFilters);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
setFilter(defaultFilters);
setFilter(defaultFilters);
return () => setFilter('all');

Should we cleanup the filter ? if the user opens the modal, toggle the filter, then closes and reposens on the same doc, defaultFilter don't change so the store will keep the old value ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it keeps the old filter, try again maybe ?
I don't clean it because depends some states of the doc, the default filter is different:

defaultFilters={isWithChildren ? 'current' : 'all'}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I see ! thanks for the explanations

Comment on lines +66 to +68
useEffect(() => {
setFilter('current');
}, [setFilter]);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
useEffect(() => {
setFilter('current');
}, [setFilter]);
useEffect(() => {
setFilter('current');
return () => setFilter('all')
}, [setFilter]);

Should we cleanup here the filter ? . If the user closes the interlinking and then opens the search modal, the filter will still be not reset ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is not a static default filter, depend the state of the doc, the default change, so we force onMount the default filter that we want to use.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK that's understandable

@AntoLC
AntoLC force-pushed the refacto/sub-docs-search branch from ca46c93 to e50ca93 Compare June 10, 2026 13:26
lunika and others added 2 commits June 10, 2026 16:44
In the search endpoint, we were returning all the parents for a document
mathing the search. We want instead to return only the top parent the
user has access to.
In the search modal, under the sub docs,
we now display the top parent of the doc, to give
more context to the user about the doc they are
looking for.
We refactorize the filters to get more flexibility
and avoid too much props drilling.
AntoLC added 2 commits June 10, 2026 16:44
The search ui has been updated to fit
the design mockup.
It includes:
- the search feature
- the move doc modal
- the interlinking search part
Improve accessibility of search components by adding
appropriate ARIA attributes and enhancing screen reader
compatibility.
@AntoLC
AntoLC force-pushed the refacto/sub-docs-search branch from e50ca93 to 6ce8533 Compare June 10, 2026 14:51
@AntoLC
AntoLC merged commit 6ce8533 into main Jun 10, 2026
41 checks passed
@AntoLC
AntoLC deleted the refacto/sub-docs-search branch June 10, 2026 15:45
lunika added a commit that referenced this pull request Jun 19, 2026
Added

- ✨(backend) add limit on distinct reactions per comment #1978
- ✨(frontend) leave a document #2410
- ✨(frontend) add top parent on sub docs search #1952
- ✨(frontend) unauthenticated users can search #2407
- ✨(backend) specific user delete method to delete its relations #2437

Changed

- 👷(CI) remove test-e2e-other-browser job #2404
- ♿️(frontend) use heading element for pinned documents section title #2380
- ♿️(frontend) use anchor links for table of contents entries #2390
- ♿️(frontend) improve presenter mode screen reader and keyboard support #2383
- ♿️(frontend) link export modal name to its heading #2422

Fixed

- 🐛(frontend) overlap of block menu dropdown #2406
- ⚡️(backend) fix N+1 queries when serializing thread comments #2415
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Display sub-docs in search results

3 participants