Replace AJAX approach with DOM manipulation for consistency

Created on 19 August 2025, 26 days ago

Problem/Motivation

cookies_addons_fields uses AJAX to load content after cookie consent, causing delays and inconsistent UX
compared to cookies_video which uses immediate DOM manipulation.

Steps to reproduce

1. Configure field blocking for video service
2. Accept cookies and observe loading delay
3. Compare with cookies_video (immediate display)

Proposed resolution

Use the same DOM manipulation pattern as cookies_video:
- Keep field content in DOM but mark as blocked
- Show/hide via JavaScript immediately when consent changes
- Remove AJAX controller and endpoint

Benefits: immediate response, simpler code, consistent UX.

Remaining tasks

- [ ] Refactor JavaScript to match cookies_video pattern
- [ ] Update PHP to keep content and use blocking classes
- [ ] Remove AJAX controller and routing
- [ ] Test immediate content display

User interface changes

Immediate content display when accepting cookies (no loading delay).

API changes

Remove AJAX endpoint `/cookies-addons-fields/get-field/` and CookiesAddonsFieldsController.

Data model changes

None.

Feature request
Status

Active

Version

1.3

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @scontzen
  • 🇩🇪Germany guido_s Cologne

    That won't work here. It might be possible for some field types, but fields can hold complete views, load libraries and so on. Nothing that could be easily solved by storing everything in a data attribute.

Production build 0.71.5 2024