Problem/Motivation

- This module was putting on the "hidden" class and I wanted it to show "visually-hidden" so that it still renders for screen readers.
- This module should not simply suppress the text from the h1 tag, it should remove the tag altogether. An empty header tag is an accessibility issue that triggers analysis tools like SiteImprove.

Steps to reproduce

1. Configure a content type and create a node of that type to use Exclude Node Title.
2. Configure its title to be hidden and view the node.
3. Configure its title to be removed and view the node.

Step 2, the title is hidden with `hidden` which is a display:none. This will not be picked up by screen readers.
Step 3, the title is emptied. This will be picked up by screen readers as an empty header.

Proposed resolution

- Apply the visually-hidden class to the title element when set to hide. This is for when we want to not show the title but have the screen reader pick up the text.
- Remove the title element entirely when set to remove. This is for when we really want to remove the title from the HTML.

Remaining tasks

- Review

User interface changes

- Removing the title should now remove its empty element. This may affect implementations that unknowingly relied on that empty element for spacing purposes, or worked around it to visually remove any spacing that empty element introduced.

API changes

None

Data model changes

None

Comments

dasginganinja created an issue. See original summary.

dasginganinja’s picture

Here is a patch which solves the issue.

fskreuz’s picture

Title: Exclude title with visually-hidden class instead of hidden » Fix accessibility issues by using visually-hidden on hide and unsetting title element on remove
Category: Feature request » Bug report
Issue summary: View changes
Status: Active » Needs review
Related issues: +#3247751: remove h1 tag instead of simply suppressing text and leaving empty h1 tag
StatusFileSize
new2.2 KB

Combining this patch with a fix for https://www.drupal.org/project/exclude_node_title/issues/3247751 to address a related accessibility issue. Having two separate patches for each issue will conflict, since the changes are in close proximity. Combining them should expedite the fix. Combined patch now:

- Applies the visually-hidden class to the title element when hidden.
- Removes the title element entirely when removed.

  • smustgrave committed 953ccb0a on 2.0.x
    Issue #3346319 by dasginganinja, fskreuz: Fix accessibility issues by...
smustgrave’s picture

Version: 8.x-1.x-dev » 2.0.x-dev
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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