Skip to content

[FIX] website: update table of content navbar when heading style changes#264152

Closed
fw-bot wants to merge 1 commit into
odoo:saas-19.3from
odoo-dev:saas-19.3-saas-18.4-opw-5950228-toc_html_style-sben-525872-fw
Closed

[FIX] website: update table of content navbar when heading style changes#264152
fw-bot wants to merge 1 commit into
odoo:saas-19.3from
odoo-dev:saas-19.3-saas-18.4-opw-5950228-toc_html_style-sben-525872-fw

Conversation

@fw-bot
Copy link
Copy Markdown
Contributor

@fw-bot fw-bot commented May 12, 2026

Steps to reproduce:

  1. Enable a second language on the website
  2. Add a Table of Content snippet to a page
  3. Apply bold (or any inline style) to one of the headings, save
  4. Switch to the second language in translation mode
  5. Translate the styled heading and save

=> The TOC navbar entry keeps showing the source text on reload.
=> Expected: navbar shows the translated heading text, unstyled.

Cause:

When a TOC heading carries inline markup, the server emits the
heading and the navbar entry as two independent translation terms
with different data-oe-translation-source-sha values, even though
their textContent matches. A translation written under the heading's
sha therefore never reaches the navbar's slot.

handleToC was meant to bridge that by aliasing the navbar span's
sha to the heading's during translation-mode setup, but two issues
prevented it from working in saas-18.4+:

  • The TOC navbar lives under .o_not_editable, so its translation
    spans were excluded from findOEditable and handleToC never
    ran on them. The class o_translation_without_style was never
    added, and the sha was never aliased.

Solution:

  • prepareTranslation iterates TOC navbar translation spans
    explicitly, so handleToC reaches them despite findOEditable
    skipping .o_not_editable.
  • handleToC always tags the navbar span with
    o_translation_without_style when a matching heading exists.
  • An after_replication_handlers hook flags every replicated
    unstyled-translation target as .o_dirty, so the replicated
    translation is included in the save.

opw-5950228

Forward-Port-Of: #263547
Forward-Port-Of: #260378

@robodoo
Copy link
Copy Markdown
Contributor

robodoo commented May 12, 2026

Pull request status dashboard

@robodoo robodoo added forwardport This PR was created by @fw-bot conflict There was an error while creating this forward-port PR labels May 12, 2026
@fw-bot
Copy link
Copy Markdown
Contributor Author

fw-bot commented May 12, 2026

@sben-odoo @robinlej cherrypicking of pull request #260378 failed.

stdout:

Auto-merging addons/website/static/src/builder/plugins/translation/translation_plugin.js
CONFLICT (content): Merge conflict in addons/website/static/src/builder/plugins/translation/translation_plugin.js
Auto-merging addons/website/static/tests/builder/translation.test.js

Either perform the forward-port manually (and push to this branch, proceeding as usual) or close this PR (maybe?).

:shipit: you can use git-fw to re-do the forward-port for you locally.

⚠️ after resolving this conflict, you will need to merge it via @robodoo.

More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port

@sben-odoo sben-odoo force-pushed the saas-19.3-saas-18.4-opw-5950228-toc_html_style-sben-525872-fw branch from 85b5fc3 to 5bc1cd5 Compare May 13, 2026 11:58
@C3POdoo C3POdoo requested a review from a team May 13, 2026 12:02
@sben-odoo sben-odoo force-pushed the saas-19.3-saas-18.4-opw-5950228-toc_html_style-sben-525872-fw branch from 5bc1cd5 to ef30ad4 Compare May 19, 2026 13:58
Steps to reproduce:
===================
1. Enable a second language on the website
2. Add a Table of Content snippet to a page
3. Apply bold (or any inline style) to one of the headings, save
4. Switch to the second language in translation mode
5. Translate the styled heading and save

=> The TOC navbar entry keeps showing the source text on reload.
=> Expected: navbar shows the translated heading text, unstyled.

Cause:
======
When a TOC heading carries inline markup, the server emits the
heading and the navbar entry as two independent translation terms
with different `data-oe-translation-source-sha` values, even though
their textContent matches. A translation written under the heading's
sha therefore never reaches the navbar's slot.

`handleToC` was meant to bridge that by aliasing the navbar span's
sha to the heading's during translation-mode setup, but two issues
prevented it from working in saas-18.4+:

- The TOC navbar lives under `.o_not_editable`, so its translation
  spans were excluded from `findOEditable` and `handleToC` never
  ran on them. The class `o_translation_without_style` was never
  added, and the sha was never aliased.

Solution:
=========
- `prepareTranslation` iterates TOC navbar translation spans
  explicitly, so `handleToC` reaches them despite `findOEditable`
  skipping `.o_not_editable`.
- `handleToC` always tags the navbar span with
  `o_translation_without_style` when a matching heading exists.
- An `after_replication_handlers` hook flags every replicated
  unstyled-translation target as `.o_dirty`, so the replicated
  translation is included in the save.

opw-5950228

X-original-commit: 76e179f
@sben-odoo sben-odoo force-pushed the saas-19.3-saas-18.4-opw-5950228-toc_html_style-sben-525872-fw branch from ef30ad4 to 23dcb1f Compare May 19, 2026 14:18
@fw-bot
Copy link
Copy Markdown
Contributor Author

fw-bot commented May 20, 2026

@sben-odoo @robinlej this forward port of #260378 is awaiting action (not merged or closed).

@sben-odoo
Copy link
Copy Markdown
Contributor

robodoo r+

robodoo pushed a commit that referenced this pull request May 20, 2026
Steps to reproduce:
===================
1. Enable a second language on the website
2. Add a Table of Content snippet to a page
3. Apply bold (or any inline style) to one of the headings, save
4. Switch to the second language in translation mode
5. Translate the styled heading and save

=> The TOC navbar entry keeps showing the source text on reload.
=> Expected: navbar shows the translated heading text, unstyled.

Cause:
======
When a TOC heading carries inline markup, the server emits the
heading and the navbar entry as two independent translation terms
with different `data-oe-translation-source-sha` values, even though
their textContent matches. A translation written under the heading's
sha therefore never reaches the navbar's slot.

`handleToC` was meant to bridge that by aliasing the navbar span's
sha to the heading's during translation-mode setup, but two issues
prevented it from working in saas-18.4+:

- The TOC navbar lives under `.o_not_editable`, so its translation
  spans were excluded from `findOEditable` and `handleToC` never
  ran on them. The class `o_translation_without_style` was never
  added, and the sha was never aliased.

Solution:
=========
- `prepareTranslation` iterates TOC navbar translation spans
  explicitly, so `handleToC` reaches them despite `findOEditable`
  skipping `.o_not_editable`.
- `handleToC` always tags the navbar span with
  `o_translation_without_style` when a matching heading exists.
- An `after_replication_handlers` hook flags every replicated
  unstyled-translation target as `.o_dirty`, so the replicated
  translation is included in the save.

opw-5950228

closes #264152

X-original-commit: 76e179f
Signed-off-by: Robin Lejeune (role) <role@odoo.com>
Signed-off-by: Saif Allah Ben Khalil (sben) <sben@odoo.com>
@robodoo robodoo closed this May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conflict There was an error while creating this forward-port PR forwardport This PR was created by @fw-bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants