feat: strip new tab notice from excerpts / make new tab notice config…#57
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR makes the “opens in new tab” accessibility notice configurable and prevents it from appearing in automatically generated WordPress excerpts.
Changes:
- Introduces a configurable
$newTabNoticevalue (viatheme.a11y_new_tab_noticewith a translated default). - Uses the configured notice when appending an
sr-onlyspan totarget="_blank"links. - Adds a
get_the_excerptfilter to strip the notice from auto-generated excerpts.
Comments suppressed due to low confidence (1)
src/Theme.php:213
createElement('span', ' ' . $this->newTabNotice)always prefixes a space even if the configured notice already contains leading whitespace. This can introduce unintended double-spacing in the rendered output. Prefer normalizing the configured notice once (e.g., trim leading whitespace in the constructor) and then add a single separator space here, or only add the separator when needed.
try {
$srOnlySpan = $doc->createElement('span', ' ' . $this->newTabNotice);
} catch (\DOMException $e) {
continue;
}
$srOnlySpan->setAttribute('class', 'sr-only');
$link->appendChild($srOnlySpan);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…dd null coalescing to preg_replace
SimonvanWijhe
approved these changes
Apr 3, 2026
Rovasch
approved these changes
Apr 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Momenteel verschijnt de tekst '(opent in nieuw tablad)' die we toevoegen aan links met een target="_blank" in automatisch gegenereerde excerpts. Deze PR maakt deze tekst configureerbaar en haalt hem uit de excerpt.
Voor:

Na:
