An empty “More Link” still creates an empty anchor tag
-
Hi!
Thank you for maintaining this great plugin. I have a request or a clarification regarding the plugin’s behavior.
In the file
include/lcp-widget.php
on line 50, we have the following code:$morelink = empty($instance['morelink']) ? ' ' : $instance['morelink'];
If the user leaves the ‘morelink’ input blank, then
$morelink
will be assigned a space (' '
) rather than an empty string (''
).Then, in your plugin file
include/lcp-catlist.php
on line 199, we have this function:/** * Load morelink name and link to the category: */ public function get_morelink() { if (!empty($this->params['morelink'])) { // <----- This will always return true $props = ['href' => get_category_link($this->lcp_category_id)]; $readmore = ($this->params['morelink'] !== '' ? $this->params['morelink'] : 'More posts'); return $this->wrapper->to_html('a', $props, $readmore); } else { return null; } }
The
get_morelink()
function will never returnnull
because the earlier snippet inlcp-widget.php
ensures$this->params['morelink']
contains a space (which is not empty).My concern is that this creates an empty anchor tag where the “Read more” link should be if the ‘morelink’ input is left blank. This causes accessibility issues, as empty anchor tags are problematic for screen readers.
Thank you for your attention to this matter.
- You must be logged in to reply to this topic.