Skip to content

Conversation

@Ovgodd
Copy link
Collaborator

@Ovgodd Ovgodd commented Jul 29, 2025

Purpose

This PR improves the accessibility of exported PDF documents by explicitly setting the document language to fr-FR as suggested in the issue 1133

This ensures proper pronunciation by screen readers (e.g. VoiceOver, NVDA), especially for homographs like “mobile” that differ between French and English.

Proposal

  • Inject language="fr-FR" into the element returned by toReactPDFDocument() using cloneElement()
  • Add inline comment explaining the purpose (screen reader compatibility)

External contributions

Thank you for your contribution! 🎉

Please ensure the following items are checked before submitting your pull request:

  • I have read and followed the contributing guidelines
  • I have read and agreed to the Code of Conduct
  • I have signed off my commits with git commit --signoff (DCO compliance)
  • I have signed my commits with my SSH or GPG key (git commit -S)
  • My commit messages follow the required format: <gitmoji>(type) title description
  • I have added a changelog entry under ## [Unreleased] section (if noticeable change)
  • I have added corresponding tests for new features or bug fixes (if applicable)

Ovgodd added a commit that referenced this pull request Jul 29, 2025
Add a note in the changelog to document frontend accessibility improvements

Signed-off-by: Cyril <[email protected]>
@Ovgodd Ovgodd force-pushed the fix/pdf-language-accessibility branch from 31d2c65 to aa70700 Compare July 29, 2025 10:19
@Ovgodd Ovgodd requested a review from AntoLC July 29, 2025 10:19
@Ovgodd Ovgodd self-assigned this Jul 29, 2025
Ovgodd added a commit that referenced this pull request Jul 29, 2025
Add a note in the changelog to document frontend accessibility improvements

Signed-off-by: Cyril <[email protected]>
@Ovgodd Ovgodd force-pushed the fix/pdf-language-accessibility branch from aa70700 to f202cc7 Compare July 29, 2025 10:21
@AntoLC AntoLC linked an issue Jul 29, 2025 that may be closed by this pull request
Copy link
Collaborator

@AntoLC AntoLC left a comment

Choose a reason for hiding this comment

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

It is a bit hard to know if this dev is working, can you add a test e2e about it ?

Tests about export are located here: https://github.com/suitenumerique/docs/blob/main/src/frontend/apps/e2e/__tests__/app-impress/doc-export.spec.ts

If you do that you can see somewhere the informations:

const pdfBuffer = await cs.toBuffer(await download.createReadStream());
const pdfString = pdfBuffer.toString('latin1');

console.log("pdfString", pdfString);

I am wondering if we should not do the same about docx export, WDYT ?

@Ovgodd
Copy link
Collaborator Author

Ovgodd commented Jul 30, 2025

It is a bit hard to know if this dev is working, can you add a test e2e about it ?

Tests about export are located here: https://github.com/suitenumerique/docs/blob/main/src/frontend/apps/e2e/__tests__/app-impress/doc-export.spec.ts

If you do that you can see somewhere the informations:

const pdfBuffer = await cs.toBuffer(await download.createReadStream());
const pdfString = pdfBuffer.toString('latin1');

console.log("pdfString", pdfString);

I am wondering if we should not do the same about docx export, WDYT ?

I agree yes, I am on it for the e2e, and for the doc export I think it is a good idea yes to make sure it also works properly and isn’t missing anything !

@Ovgodd
Copy link
Collaborator Author

Ovgodd commented Jul 30, 2025

@AntoLC the e2e test for language injection has been added. Would you like me to create the other test for the DOCX export in this PR as well ?
image

@Ovgodd Ovgodd force-pushed the fix/pdf-language-accessibility branch 3 times, most recently from ab06646 to a3150ed Compare July 30, 2025 09:57
@AntoLC
Copy link
Collaborator

AntoLC commented Jul 30, 2025

@AntoLC the e2e test for language injection has been added. Would you like me to create the other test for the DOCX export in this PR as well ?

If this PR is ready, let's do it in another PR for DOCX.

@Ovgodd
Copy link
Collaborator Author

Ovgodd commented Jul 30, 2025

@AntoLC the e2e test for language injection has been added. Would you like me to create the other test for the DOCX export in this PR as well ?

If this PR is ready, let's do it in another PR for DOCX.

Yes this PR is ready, Ok I will do an another one, the goal is to test Injection language in DOCX export right ?

@Ovgodd Ovgodd force-pushed the fix/pdf-language-accessibility branch from a3150ed to 5a3e3b3 Compare July 30, 2025 14:13
@AntoLC AntoLC self-requested a review July 31, 2025 09:40
@Ovgodd Ovgodd force-pushed the fix/pdf-language-accessibility branch 2 times, most recently from bf9ee00 to 4cf487b Compare July 31, 2025 10:19
@AntoLC AntoLC force-pushed the fix/pdf-language-accessibility branch from 4cf487b to 417caa4 Compare July 31, 2025 10:47
@AntoLC AntoLC self-requested a review July 31, 2025 10:48
@Ovgodd Ovgodd force-pushed the fix/pdf-language-accessibility branch 4 times, most recently from 04aaf54 to 937bf02 Compare August 4, 2025 06:25
@Ovgodd Ovgodd closed this Aug 4, 2025
@Ovgodd Ovgodd force-pushed the fix/pdf-language-accessibility branch from 937bf02 to 7813219 Compare August 4, 2025 06:35
Ovgodd added 2 commits August 4, 2025 09:35
added language="fr-FR" to <Document /> in ModalExport.tsx via cloneElement()
to improve accessibility and ensure correct screen reader pronunciation

Signed-off-by: Cyril <[email protected]>
Adds an end-to-end test to verify language injection in the generated PDF.

Signed-off-by: Cyril <[email protected]>
@AntoLC AntoLC reopened this Aug 4, 2025
@Ovgodd Ovgodd merged commit 1cdb6b6 into main Aug 4, 2025
38 of 40 checks passed
@Ovgodd Ovgodd deleted the fix/pdf-language-accessibility branch August 4, 2025 08:00
@Erwan-le-Gall
Copy link

Thank you Cyril! @Ovgodd
to check if language is set you can use Acrobat Reader menu File / Properties / Advanced tab
Capture d’écran 2025-08-04 à 10 32 47

@AntoLC AntoLC mentioned this pull request Sep 4, 2025
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.

add a language tag to PDF metadata export

4 participants