Skip to content

List: the id column is six characters wide, wider only when it must be - #28

Merged
bpacholek merged 1 commit into
mainfrom
bober/recomaty-panel-677
Oct 27, 2026
Merged

bpacholek merged 1 commit into
mainfrom
bober/recomaty-panel-677

Conversation

@bpacholek

@bpacholek bpacholek commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

On a list with few columns in a wide card, the identifier column took a share of the spare width like every other column. The automatic table layout hands the surplus out in proportion to what each column holds, so a one- to five-digit id got a few hundred pixels of empty space beside it: 176px for the demo's category list at 1920px. In recomaty-panel it shows on most lists, the Ping and Status lists the most (reported in recomaty/recomaty-panel#677). @bpacholek asked for the column to assume six characters and widen only when an identifier needs more, and thought the fix belongs in adminata rather than in the panel.

  • fdcc5f0cc Markup (additive hooks):
    • CRUD/base_list_field.html.twig: the <td> of a column that shows the model's identifier gets the class adminata-list-field-id. "Shows the identifier" means the field's name is one of admin.modelManager.identifierFieldNames(admin.class) (id on a Doctrine entity), whatever the field's type (integer, identifier, string...). The class sits outside the field_cell_class block, so a cell template overriding that block keeps it. The envelope's comment says this is now the one difference from upstream's <td>.
    • CRUD/base_list.html.twig: the header of that column gets adminata-list-field-header-id. The identifier names are read once per table, in table_header.
    • Both hooks join the list group of tests-adminata/Contract/hooks.yaml.
  • components/list.css: a new rule beside the batch/select/actions one:
    .adm-table th.adminata-list-field-header-id, .adm-table td.adminata-list-field-id { box-sizing: content-box; width: 6ch; min-width: 6ch; white-space: nowrap; }
    • width makes the column a fixed one. The automatic layout gives the surplus to the columns without a width first, so the table still fills its card and the id column keeps six characters.
    • width only raises a column's largest size. On a list wider than its card every column is squeezed to its smallest, and min-width keeps six characters there too. Chromium, Firefox and WebKit all honour min-width on cells.
    • Neither is a cap. A longer identifier (a ten-digit number, a UUID, a MongoDB ObjectId) or a longer header label widens the column. nowrap keeps it on one line: without it a UUID broke at a hyphen in Chromium and WebKit.
    • content-box: the six characters are the text's, and the cell padding comes on top. ch is a "0" in the cell's own font (the header's 12px ch is smaller than the body's 14px one, so the body cells set the width).
    • app.css is rebuilt (one rule). Safelist, contract.json and the controllers snapshot are unchanged.
  • Tests:
    • tests-adminata/Visual/list-id-column.spec.js (new) runs in the wide projects of Chromium, Firefox and WebKit. On the category list at 1920x1080, the id cell's content box equals 6ch and the table still fills its scroll box. On the product list (wider than its card), the content box is still 6ch. With a ten-digit id and with a UUID written into the cells, the column is wider than 6ch, fits the text and keeps it on one line. On the product list, the hooks are on exactly one header and on every row's integer id cell.
    • Against the old app.css, the six-character cases fail in all three engines: on the category list at 1920 the id column was 176px wide, and on the product list its content box was 29px. The UUID case fails in Chromium and WebKit.
    • DemoSmokeTest::testTheIdentifierColumnIsMarked: the hooks on the product and tag lists. On the tag list (no batch column) they are on the first column.
  • Fixtures and baselines: the JS fixtures were re-dumped (make js-fixtures); only the two classes changed. 16 screenshot baselines were regenerated in mcr.microsoft.com/playwright:v1.63.0-noble: product-list, category-list-autocomplete (narrow and medium) and tag-list, in both themes. They differ only in the id column: six characters wide now, narrower than before on wide cards and wider than the bare "Id" on narrow ones.
  • CHANGELOG: [Unreleased] → ### Fixed: one entry.

Contract

  • Additive only: two new adminata-* hooks, no template, block, registry key, config node or service id removed or renamed. By CONTRIBUTING's table that is a minor release, because the markup gains hooks.
  • No Bootstrap/AdminLTE class, no jQuery, no inline script. make check-names: clean.

Gates (local)

  • npm run build: only src/Resources/public/app.css changes.
  • Stylelint, css:layers, Prettier, ESLint, check:jquery, fixture, css:contract, size: OK. Vitest: 281 passed.
  • php-cs-fixer (both configurations), composer validate/normalize, lint:container, lint:twig, lint:xliff, lint:yaml, check-names: OK.
  • Not run here: yamllint and xmllint (not installed on this machine; the only YAML change is two list items and a comment in hooks.yaml, which lint:yaml parses).
  • PHPUnit, all suites: 2639 tests, no failures. 29 errors, all from this machine's environment: 26 Panther tests (no geckodriver) and 3 MongoDB tests (no MongoDB server). tests/Twig gives the same counts before and after the change (596 tests).
  • PHPStan: 42 errors, none in a file this PR touches. main's own "Quality assurance" run at a132baeaf fails too.
  • Rector: did not finish here. Its child processes time out after 120 s on this 2-core machine, so CI has the say.
  • Playwright, in the CI image against the demo on MySQL 8.4:
    • list-id-column.spec.js: 15 passed (5 tests × 3 engines).
    • dashboard.spec.js: before the baselines were regenerated, exactly the 16 list screenshots above failed. The same 18 tests pass on main's templates.
    • The full suite (npx playwright test, all 9 projects, 30 min on this machine): 1360 passed, 104 skipped, 0 failed.

CI (fdcc5f0)

  • Green:
    • Visual (screenshots, axe, html-validate)
    • Test on PHP 8.4 highest/lowest, PHP 8.5 highest, and PHP 8.5 + Symfony 8.1
    • MongoDB fork unit suite
    • Front end (Node 24, 26)
    • Lint, PHP-CS-Fixer, Symfony lint, Sphinx
  • Red, with nothing from this change:
    • PHPStan ×2: the same 42 errors as main's latest Quality assurance run at a132baeaf. The error lists are identical.
    • Rector ×2: the same 5 files as on main.
    • "PHP 8.5 + highest + symfony 7.4.*": the job failed at "Initialize containers" (the runner's service containers), before checkout, so no test ran. It needs a re-run.

Worth knowing

  • The cell envelope now reads admin.modelManager.identifierFieldNames(admin.class) and field_description.name. A real admin and a real field description always have both. An application test that renders the envelope with strict Twig and hand-written doubles has to give its doubles those three members. recomaty-panel had one such test (its PR adds them); this repository's tests/Twig mocks return stubs, so its expected HTML is unchanged.

Part of recomaty/recomaty-panel#677. The panel's draft PR, recomaty/recomaty-panel#679, moves its composer.lock to this branch's commit fdcc5f0, so the change can be seen there before this one is merged. After the merge, the panel's lock moves to the merge commit.

Bober's change for recomaty/recomaty-panel#677, made at Bartosz's request.

🦫 ~Bober

On a list with few columns in a wide card the identifier column took a
share of the spare width like any other (recomaty-panel#677): the
automatic table layout hands the surplus out in proportion to what each
column holds, so a one- to five-digit id got a few hundred pixels of
empty space beside it (176px on the demo's category list at 1920px; the
panel's Ping and Status lists showed it the most).

- base_list_field: the cells of a column that shows the model's
  identifier (its name is one of the model manager's
  identifierFieldNames(), `id` on a Doctrine entity, whatever the
  field's type) carry the new additive hook `adminata-list-field-id`,
  outside the `field_cell_class` block so a cell template overriding
  that keeps it. base_list marks the header the same way,
  `adminata-list-field-header-id`.
- components/list.css: both get `width` and `min-width: 6ch`
  (`content-box`, the padding on top) and `nowrap`. The width makes the
  column a fixed one, so the surplus goes to the other columns and the
  table still fills its card; the minimum keeps six characters on a
  list wider than its card, where every column is squeezed to its
  smallest. A longer identifier (a UUID, an ObjectId, a ten-digit
  number) or header label widens the column on one line.
- tests-adminata/Visual/list-id-column.spec.js: the column measured in
  the wide projects of Chromium, Firefox and WebKit: six characters on
  the category list at 1920px with the table still filling the card,
  six on the overflowing product list, one line and wider for a
  ten-digit id and a UUID, the hooks on the header and every cell and
  nowhere else. Without the CSS the six-character and UUID cases fail
  (the UUID breaks at a hyphen in Chromium and WebKit).
- DemoSmokeTest pins the hooks on the product and tag lists; both join
  the list group of tests-adminata/Contract/hooks.yaml.
- app.css rebuilt; JS fixtures re-dumped (the two new classes); the
  product, category-autocomplete and tag list baselines regenerated in
  the Playwright 1.63 image (their id column is six characters now).
- CHANGELOG entry under Fixed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bpacholek
bpacholek marked this pull request as ready for review October 27, 2026 16:47
@bpacholek
bpacholek merged commit 078d2b1 into main Oct 27, 2026
16 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant