Problem/Motivation
While using Gin Admin theme, Form TableSelect type('#type' => 'tableselect',
) is adding 2 checkboxes. The Gin Admin theme is part of the Starshot initiative. While checking the Starshot will come with this issue.
Steps to reproduce
1. Ensure your website has Gin Admin theme and is selected for administrator.
2. Install the
Automatic update →
module
3. Visit the URL /admin/modules/automatic-update-extensions
4. See the table that will have the Select all checkbox twice.
Proposed resolution
After reviewing the code able to know, that the Gin Admin theme overrides the Drupal core tableselect.js and uses its Template and JS. From the JS and Twig, the checkboxes are added. From one place of adding is enough.
From twig,
table.html.twig
and views-view-table.html.twig
{% endif %}
<{{ cell.tag }}{{ cell.attributes.addClass(cell_classes) }}>
{{- cell.content -}}
{% if 'gin--sticky-bulk-select' in cell_classes %}
<input
type="checkbox"
class="form-checkbox form-boolean form-boolean--type-checkbox"
title="{{ 'Select all rows in this table'|t }}"
/>
{% endif %}
</{{ cell.tag }}>
{% endfor %}
From JS,
tableselect.js
$table
.find('th.select-all')
.prepend($(Drupal.theme('checkbox')).attr('title', strings.selectAll))
.on('click', (event) => {
if (event.target.matches('input[type="checkbox"]')) {
It would be better to remove the append checkbox from the JS.
Remaining tasks
Create MR and do the test.
User interface changes
API changes
Data model changes