Each <form>
element and form role that needs to be exposed as a landmark must be given an accessible name. This name will allow an assistive technology user to be able to quickly understand the purpose of the form landmark. This could be title= or aria-label=
For example
<form action="<?php echo Route::_('index.php?option=com_content&layout=' . $layout . $tmpl . '&id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="item-form" aria-label="<?php echo Text::_('COM_CONTENT_EDIT_ARTICLE'); ?>" class="form-validate">
It's a fairly simple task for me to do this BUT its not status aware. ie it would always be Form: Edit Article even if its a brand new article where we might have chosen to have Form: New Article
I am happy for it to be hardcoded as above with Edit Article but if there is an easy way to do this in the API with the New/Edit change then that would be better - I couldnt find a way to do that but it doesnt mean it doesnt exist.
Another option might be to change the article.xml and add the label to the form element but again that option doesn't appear to exist (yet)
cc @wilsonge @chmst Please advise - happy to do the work but only want to do it once ;)
Labels |
Added:
?
|
Is Form: Edit Article
really the text we want to use anyhow for something like skipto? Is a more generic content form string or something more logical given the h1 parent will already have presented that at the top?
Same question from me. The title in backend screens says which form ist present and a generic string should be sufficient.
For frontend it might be different.
Labels |
Added:
?
|
I am happy for it to be hardcoded as above with Edit Article but if there is an easy way to do this in the API with the New/Edit change then that would be better - I couldnt find a way to do that but it doesnt mean it doesnt exist.
For the title we use this code snipped
ToolbarHelper::title(
Text::_('COM_CONTENT_PAGE_' . ($checkedOut ? 'VIEW_ARTICLE' : ($isNew ? 'ADD_ARTICLE' : 'EDIT_ARTICLE'))),
'pencil-alt article-add'
);
we doesn't use any automatism for it.
Not sure if adding the title/aria-label to the xml because you would need a convention like
<form aria-label="COM_CONTENT_FORM_TITLE"></form>
Language file:
COM_CONTENT_FORM_TITLE_NEW="New Article"
COM_CONTENT_FORM_TITLE_EDIT="Edit Article"
; alternativbe
COM_CONTENT_FORM_TITLE="Article"
template:
<form action="<?php echo Route::_('index.php?option=com_content&layout=' . $layout . $tmpl . '&id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="item-form"
aria-label="<?php echo Text::_($form->getLabel__NewFunction() . ($isNew ? '_NEW', '_EDIT'), true); ?>"
class="form-validate">
or
<?php
// this maybe could be done in jform or in a layout for <form> (not so sure about this)
$formTitle = $form->getLabel__NewFunction() . ($isNew ? '_NEW', '_EDIT');
if (!$language->hasKey($formTitle)) {
; use fallback
$formTitle = $form->getLabel__NewFunction();
}
?>
<form action="<?php echo Route::_('index.php?option=com_content&layout=' . $layout . $tmpl . '&id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="item-form"
aria-label="<?php echo Text::_($formTitle, true); ?>"
class="form-validate">
As complete alternative you can use 2 form attributes aria-label-new="COM_CONTENT_FORM_TITLE_NEW"
and aria-label-edit="COM_CONTENT_FORM_TITLE_EDIT"
but I think that's worse (but maybe more flexible for on the fly manipulation).
Other question where comes the "From:" from in skipTo?
given the h1 parent will already have presented that at the top
@wilsonge @chmst The text has to work on its own independent of any other text on the page
For the title we use this code snipped
@HLeithner that is what I tried but failed, your code doesn't work either
Other question where comes the "From:" from in skipTo?
@HLeithner it comes directly from the skipto plugin
edit: sorry brian I changed your comment instead of creating a new one...
that is what I tried but failed, your code doesn't work either
That was only pseduo code here something which should work
<form action="<?php echo Route::_('index.php?option=com_content&layout=' . $layout . $tmpl . '&id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="item-form"
aria-label="<?php echo Text::_('COM_CONTENT_FORM_TITLE_' . ( (int) $this->item->id === 0 ? '_NEW' : '_EDIT'), true); ?>"
class="form-validate">
Thanks it was the $isNew bit that wasn;t working ;)
Also in your code the ternary condition needs to be ? 'x' : 'y' and not ? 'x', 'y'
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-01-16 12:36:40 |
Closed_By | ⇒ | brianteeman | |
Labels |
Added:
?
Removed: ? |
The question is do we really new "new Article", does this makes any different for a person who needs a screenreader? The person already knows that he/she is on a "Content: New Article" page. Sound a bit like an overkill.
PS: yes the ternary syntax error was a copy paste error corrected it.
It is only slightly more code to do it right so might as well
Note - I suspect that this will be a multi-stage task of at least