https://dequeuniversity.com/rules/axe/3.5/empty-heading
Screen readers alert users to the presence of a heading tag. If the heading is empty or the text cannot be accessed, this could either confuse users or even prevent them from accessing information on the page's structure.
An example of where joomla fails on this is the new user form as this line
<h2><?php echo $this->form->getValue('name'); ?></h2>
results in
<h2></h2>
There are many ways to resolve this
<?php if ($this->item->id != 0): ?>
<h2><?php echo $this->form->getValue('name'); ?></h2>
<?php endif; ?>
<?php if ($this->item->id != 0): ?>
<h2><?php echo Text::_('COM_USERS_VIEW_NEW_USER_TITLE'); ?></h2>
<?php else: ?>
<h2><?php echo $this->form->getValue('name'); ?></h2>
<?php endif; ?>
Labels |
Added:
?
|
Category | ⇒ | Accessibility |
@brianteeman Can you propose an alternative default value ?
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-07-03 19:12:15 |
Closed_By | ⇒ | alikon |
Closed_By | alikon | ⇒ | joomla-cms-bot |
Set to "closed" on behalf of @alikon by The JTracker Application at issues.joomla.org/joomla-cms/29909
as per #29920
Please re-open - only one instance is fixed in that pr
Status | Closed | ⇒ | New |
Closed_Date | 2020-07-03 19:12:15 | ⇒ | |
Closed_By | joomla-cms-bot | ⇒ |
right
@brianteeman when more issues found, please inform me.
I had another look last night and I didnt see them - I was sure I found more than these two originally ;(
I will close it for now.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-07-05 11:38:51 |
Closed_By | ⇒ | brianteeman |
@brianteeman if I'm correct the public function for getValue of $this->form is declared in libraries/src/Form/Form.php
And this function has an
optional default value of the field value is empty.
joomla-cms/libraries/src/Form/Form.php
Lines 539 to 563 in 4e1013a
Agree?
let me propose possible solution numer 4.
We can benefit the default value, instead of an if-then-else statement.
if no name is given, the default value (third parameter), will be used.
What do you think of this solution?