Toolbar children elements included in DOM count

Created on 14 June 2025, 3 months ago

Problem/Motivation

In the preview.js script, the current selector counts DOM elements incorrectly:

```
const elementCount = document.querySelectorAll("*:not(#toolbar-administration, #node-preview-form-select)").length;
```

Although the selector excludes the toolbar and preview form elements themselves, it still counts their child elements in the total DOM count.
Expected behaviour (example with console.log in the figure)

The parent elements (#toolbar-administration, #node-preview-form-select) AND their children should be excluded from the count.

Steps to reproduce

  1. Go on console web browser
  2. Use : ```const elementCount = document.querySelectorAll("*:not(#toolbar-administration, #node-preview-form-select)");```
  3. View toolbar elements like in figure
🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇫🇷France pcharrat La rue, la vraie.

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

Comments & Activities

  • Issue created by @pcharrat
  • 🇫🇷France pcharrat La rue, la vraie.
  • 🇫🇷France pcharrat La rue, la vraie.
  • 🇫🇷France pcharrat La rue, la vraie.

    Here's a patch that removes the 63 child elements from the toolbar using a more specific js selector.
    You'll also find browser logs with all the numbers.

  • Status changed to Fixed 6 days ago
  • 🇫🇷France jenue1933 Bordeaux

    Hi,

    I added a route to get EcoIndex values without administration context on release beta3.

    This link is display on EcoIndex widget. If you want to refresh EcoIndex click to this new link to calculate the score/grade, come back on node edit form and submit values.

Production build 0.71.5 2024