Problem/Motivation

According to the example provided on Tables with Multi-Level Headers empty <th> should be replaced by <td> elements:

In the following code snippet, the headers for the header cells themselves have been set to an empty cell (with the id “blank”). This will prevent some assistive technologies from reading a header for those heading cells.

Steps to reproduce

  1. Use CKEditor to add a table to a text field.
  2. Leave one or more header elements empty.
  3. View the page source.
  4. Notice that the empty elements are <th>&nbsp;</th>.

Proposed resolution

  • Add a text filter that replaces empty <th> elements with <td>.
  • All attributes from the original <th>, except for the scope attribute, should be transferred to the new <td> element.
  • Besides <th> elements containing no text, also &nbsp; and similar cases should be considered empty.
  • The new text filter is meant to run after the existing table_header_scope_attribute filter; otherwise, automatically determining the scope will likely yield incorrect values. Validation should be added to the configuration form.
  • Add functional, kernel, or unit tests to cover the new functionality.

Remaining tasks

  1. Create the text filter that replaces empty <th> elements with <td>.
  2. Add validation to ensure the correct ordering of the filters provided by this module.
  3. Add/extend tests
  4. Update README.md

User interface changes

None.

API changes

None.

Data model changes

None.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

watergate created an issue. See original summary.

watergate’s picture

Assigned: Unassigned » watergate

  • watergate committed dbff9c07 on 2.x
    [#3554443] feat: Add a filter plugin to replace empty <th> elements with...
watergate’s picture

Assigned: watergate » Unassigned
Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.