mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-78282 output: new sr_text renderer method
Some output classes require pre-rendered elements. In some cases, those elements require some screen reader extra texts (especially in buttons). The st_text method allow the outputs to create those inline tags without using html_writer. Furthermore, the current screen reader classes are based on bootstrap, having them isolated in renderer methods allow themes to implement alternatives accessibility HTML structures.
This commit is contained in:
parent
01e0e56665
commit
a586e952ff
@ -3277,6 +3277,20 @@ EOD;
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs a screen reader only inline text.
|
||||
*
|
||||
* @param string $contents The contents of the paragraph
|
||||
* @return string the HTML to output.
|
||||
*/
|
||||
public function sr_text(string $contents): string {
|
||||
return html_writer::tag(
|
||||
'span',
|
||||
$contents,
|
||||
['class' => 'sr-only']
|
||||
) . ' ';
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs a container.
|
||||
*
|
||||
|
@ -53,6 +53,7 @@ information provided here is intended especially for developers.
|
||||
the page displays a heading for the activity (usually a h2 heading containing the activity name).
|
||||
* New method moodleform::filter_shown_headers() is created to show some expanded headers only and hide the rest.
|
||||
* count_words() and count_letters() have a new optional parameter called $format to format the text before doing the counting.
|
||||
* New core_renderer::sr_text method to generate screen reader only inline texts without using html_writter.
|
||||
|
||||
=== 4.2 ===
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user