Skip to content

[19.0][IMP] base_tier_validation: rewrite tier_review_widget collapse with native <details>#44

Draft
bosd wants to merge 1 commit into
OCA:19.0from
bosd:19.0-imp-base_tier_validation-details-rewrite
Draft

[19.0][IMP] base_tier_validation: rewrite tier_review_widget collapse with native <details>#44
bosd wants to merge 1 commit into
OCA:19.0from
bosd:19.0-imp-base_tier_validation-details-rewrite

Conversation

@bosd
Copy link
Copy Markdown
Contributor

@bosd bosd commented May 14, 2026

Summary

Replace the OWL-driven panel/card collapse machinery in the embedded Reviews widget with the native HTML5 <details> / <summary> element. Browser handles open/close state, keyboard accessibility, and the disclosure triangle; no JavaScript needed.

What goes away

  • onToggleCollapse handler (~13 lines walking ev.currentTarget.closest(".panel-heading") then toggling style.display manually).
  • useState import and this.state.collapse boolean.
  • <a class="o_info_btn" data-toggle="..." t-on-click="..."> shim and the explicit <div id="collapse1" class="collapse"> wrapper.
  • Bootstrap 3 leftover SCSS (.panel-group, .panel-heading, .panel-title, .panel-body all dropped — none of these classes exist in Bootstrap 5 which Odoo 19 ships).

What replaces it

  • <details class="o_tier_review_details" open="open"><summary>Reviews</summary><div class="o_tier_review_body">...</div></details>. The open attribute defaults to expanded, matching the previous default.
  • A small SCSS layer re-skinning the disclosure marker so it looks like Odoo's FontAwesome caret: summary::before { content: "\f0d7" }, rotates -90° when the <details> is closed. summary::-webkit-details-marker { display: none } so we don't render two triangles.

Net effect

Before After
JS ~30 LOC 13 LOC
SCSS 12 selectors (Bootstrap 3 + custom) 5 selectors (Odoo namespaced)
Accessibility <a href="#"> shim, click-only Native <details>, Space/Enter, screen-reader-aware

Same UX (click Reviews heading to toggle, defaults to open).

Overlap with PR #23

PR #23 modernised the same widget from Bootstrap 3 (panel-*) to Bootstrap 5 (card-*). This PR goes one step further and removes the surrounding card scaffolding entirely. If PR #23 lands first, this PR will need a trivial conflict resolution on the same files — net result is identical. If this PR lands first, the Bootstrap-modernisation commit in PR #23 becomes redundant for these files (the rest of PR #23 — search view, avatars, icons, coverage tests — is unaffected).

Test plan

  • Open a validated document (e.g. account.move under tier validation). The Reviews section is open by default with the caret pointing down.
  • Click the Reviews heading: panel collapses, caret rotates to point right.
  • Click again: expands back.
  • Tab-focus the summary and press Space or Enter: same toggle. (Keyboard accessibility was not available with the previous <a> shim.)

…native <details>

Replace the OWL-driven panel/card collapse machinery with the native
HTML5 ``<details>`` / ``<summary>`` element. The browser handles the
toggle, the open state and keyboard accessibility natively; no
JavaScript needed.

Removed:

- ``onToggleCollapse`` handler in ``tier_review_widget.esm.js``
  (~13 lines walking ``ev.currentTarget.closest(".panel-heading")``
  / ``.card-header`` and toggling ``style.display`` manually).
- ``useState`` import and the ``this.state.collapse`` boolean.
- The ``<a class="o_info_btn" data-toggle="..." t-on-click="...">``
  shim and the explicit ``<div id="collapse1" class="collapse">``
  wrapper.

Added:

- ``<details class="o_tier_review_details" open="open"><summary>``
  with the same "Reviews" label. ``open`` attribute defaults to
  expanded, matching the previous behaviour.
- SCSS to re-skin the disclosure marker: ``summary::before`` shows
  the FontAwesome caret (``\f0d7``) and rotates -90° when the
  ``<details>`` is closed. ``summary::-webkit-details-marker``
  hidden so we don't render two triangles.

Net effect:

- ~30 lines of JS gone, ``useState`` import dropped.
- ~12 lines of SCSS replaced (Bootstrap 3 ``panel-*`` rules dropped
  outright; the new selectors target a single ``.o_tier_review_*``
  namespace).
- Same UX (click ``Reviews`` heading to toggle).
- Accessibility: native ``<details>`` is keyboard-operable
  (Space / Enter) out of the box; the previous ``<a href="#">``
  shim wasn't.
@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hi @LoisRForgeFlow,
some modules you are maintaining are being modified, check this out!

@OCA-git-bot OCA-git-bot added mod:base_tier_validation Module base_tier_validation series:19.0 labels May 14, 2026
@bosd bosd marked this pull request as draft May 14, 2026 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:base_tier_validation Module base_tier_validation series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants