Fix orphaned table footer labels and restore input-label lint - #1348
Conversation
Associate Search, Rows, and Page with their controls via for/id. Use spans for result text and for Rows/Page when no select is rendered. Re-enable require-input-label on the pass-table template.
|
Works for me locally. I will ask someone with a better ui knowledge to do a review. |
jaredgalanis
left a comment
There was a problem hiding this comment.
Thanks for wiring up the label associations! One concern with the approach: the three id values (pass-table-filter-input, pass-table-page-size-select, pass-table-page-select) are hardcoded strings in a reusable component, so any page that renders two PassTables at once will emit duplicate ids.
Since label[for] resolves document-wide in DOM order, every label in the second table would target the first table's controls — clicking "Search:" on table 2 focuses table 1's filter input, and the same goes for the "Rows:" and "Page:" selects. We're safe today only by coincidence: grants/index.gts invokes PassTable twice, but inside mutually exclusive {{#if isAdmin}}/{{else if isSubmitter}} branches, so only one instance is ever in the DOM at a time. Nothing guards this — no-duplicate-id only lints within a single template.
Could we use Ember's built-in uniqueId helper (from @ember/helper, available on our ember-source) instead? Something like:
{{#let (uniqueId) as |filterId|}}
<label class='input-group-text' for={{filterId}}>Search:</label>
<input id={{filterId}} type='text' class='filterString form-control' ... />
{{/let}}
Same pattern for the two selects. That keeps the label→control association this PR is adding while making each table instance's ids unique.
Hardcoded ids would collide if two tables rendered at once; label[for] resolves document-wide. Ember uniqueId keeps each instance distinct.
|
|
Good catch! I switched Search, Rows, and Page to Ember uniqueId so each PassTable instance gets its own ids. label[for] should associate correctly now when more than one table is in the DOM. |



Summary
Corrects form-label markup in
PassTable(Grants, Grant Details, Submissions) and turnsrequire-input-labelback on for this template.<span>. When the Rows or Page select is not rendered, those captions are<span>s as well.<label for="…">and matchingids on the input/select when those controls exist.require-input-labelfrom the template-lint disable so ember-template-lint checks this file again.no-invalid-interactivestays disabled (unrelated).Fixes eclipse-pass/main#1259
How to test
formatches the controlid. “Show …” is a<span>.<span>s. No<label>without a control.require-input-labelshould pass forpass-table.