Split the filter-builder component #641

Closed
opened 2026-11-04 09:06:43 +01:00 by simon · 0 comments
Owner

Motivation

lib/mv_web/components/add_filter_builder_component.ex has 1,775 lines and bundles four concerns: the field picker, seven render_value_control/1 clauses, the chip catalog and the dispatch layer. The #548 review was deferred wholesale; this issue takes the part that still applies on main c3d99735.

The date_filters whole-map race (#548 ) is a correctness bug and goes to #549 (comment drafted in gitea-comments.md); the microcopy items are in issue-i18n-catalog-hygiene.md.

Findings still open

  • Size: extract FilterValueControls and FilterChips as index/ submodules; render/1 (~230 lines) shrinks accordingly.
  • Stale docs: line 4 and test/mv_web/live/member_live/index_groups_filter_test.exs:5 still name the removed MemberFilterComponent; index.ex's moduledoc message and URL-parameter lists omit what #548 added; export_payload.ex's moduledoc overclaims.
  • Duplication: period_tooltip/1 clauses 1 and 3 identical (payment_aging.ex:291-305); option ordering defined twice (render/1 vs picker_options/1); :exit_date descriptor duplicates :active_former (editing an "Exited: …" chip opens "Filter: Active / former"); scope_tooltip/3 called twice per header cell. Re-verify each before changing.
  • Dead code: suspended_count/2 (payment_aging.ex:417) has no caller; __payment still sent in index_value_control_test.exs:275,456; handle_info({:reset_all_filters, …}) (index.ex:334) unreachable; four unreferenced data-testids (date-resolved is the only handle on the local-format echo, so give that echo a real test).
  • Accessibility: "+ Add filter" declares aria-haspopup="listbox" (line 155) while opening a role="dialog"; the match-count live region is inserted already filled (:if={@open_picker}); role="option" buttons plus aria-activedescendant put every option in the Tab order (U7's <.combobox> may solve this); the payment scope badge mounts PopoverTooltip on a non-focusable <span>.
  • Tests: two index_payment_wiring_test.exs cases are subsumed by the §2.9 property test; build_query_params/1 threads six rebinds instead of a pipeline.

Acceptance criteria

  • No module over the project's size guideline; behaviour unchanged (existing tests green, component_event_targets_test.exs green).
  • The a11y items pass the axe scan and a keyboard walk in Firefox and Chromium.
## Motivation `lib/mv_web/components/add_filter_builder_component.ex` has 1,775 lines and bundles four concerns: the field picker, seven `render_value_control/1` clauses, the chip catalog and the dispatch layer. The #548 review was deferred wholesale; this issue takes the part that still applies on `main` `c3d99735`. The `date_filters` whole-map race (#548 ) is a correctness bug and goes to #549 (comment drafted in `gitea-comments.md`); the microcopy items are in `issue-i18n-catalog-hygiene.md`. ## Findings still open - [ ] **Size:** extract `FilterValueControls` and `FilterChips` as `index/` submodules; `render/1` (~230 lines) shrinks accordingly. - [ ] **Stale docs:** line 4 and `test/mv_web/live/member_live/index_groups_filter_test.exs:5` still name the removed `MemberFilterComponent`; `index.ex`'s moduledoc message and URL-parameter lists omit what #548 added; `export_payload.ex`'s moduledoc overclaims. - [ ] **Duplication:** `period_tooltip/1` clauses 1 and 3 identical (`payment_aging.ex:291-305`); option ordering defined twice (`render/1` vs `picker_options/1`); `:exit_date` descriptor duplicates `:active_former` (editing an "Exited: …" chip opens "Filter: Active / former"); `scope_tooltip/3` called twice per header cell. Re-verify each before changing. - [ ] **Dead code:** `suspended_count/2` (`payment_aging.ex:417`) has no caller; `__payment` still sent in `index_value_control_test.exs:275,456`; `handle_info({:reset_all_filters, …})` (`index.ex:334`) unreachable; four unreferenced `data-testid`s (`date-resolved` is the only handle on the local-format echo, so give that echo a real test). - [ ] **Accessibility:** "+ Add filter" declares `aria-haspopup="listbox"` (line 155) while opening a `role="dialog"`; the match-count live region is inserted already filled (`:if={@open_picker}`); `role="option"` buttons plus `aria-activedescendant` put every option in the Tab order (U7's `<.combobox>` may solve this); the payment scope badge mounts `PopoverTooltip` on a non-focusable `<span>`. - [ ] **Tests:** two `index_payment_wiring_test.exs` cases are subsumed by the §2.9 property test; `build_query_params/1` threads six rebinds instead of a pipeline. ## Acceptance criteria - No module over the project's size guideline; behaviour unchanged (existing tests green, `component_event_targets_test.exs` green). - The a11y items pass the axe scan and a keyboard walk in Firefox and Chromium.
simon closed this issue 2026-11-09 12:43:34 +01:00
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
local-it/mitgliederverwaltung#641
No description provided.