|
6 | 6 | - Certification
|
7 | 7 | ---
|
8 | 8 |
|
| 9 | +import { ValidExample } from '@site/src/components'; |
| 10 | + |
9 | 11 | Moodle is designed to provide equal functionality and information to all people. This means that there should be no barriers for people regardless of disabilities, assistive technologies that are used, different screen sizes and different input devices (for example mouse, keyboard and touchscreen).
|
10 | 12 |
|
11 | 13 | ## Accessibility conformance
|
@@ -121,7 +123,80 @@ See [the ARIA best practice advice on landmarks](https://www.w3.org/TR/wai-aria-
|
121 | 123 |
|
122 | 124 | All pages should have a unique title that describes the current page.
|
123 | 125 |
|
124 |
| -See [the WCAG 2.1 success criteria for web page titles](https://www.w3.org/TR/WCAG21/#page-titled) for further information. |
| 126 | +Some tips for providing a meaningful page title: |
| 127 | + |
| 128 | +- The page title must be accurate and informative. |
| 129 | +- If the page causes a _change of context_ (for example, a search functionality), it should describe the result or change of context to the user. |
| 130 | +- It should be concise. |
| 131 | +- If possible, it should uniquely identify the page. |
| 132 | +- The most identifying information should come first. |
| 133 | + |
| 134 | +:::note change of context |
| 135 | + |
| 136 | +(not to be confused with Moodle's `\core\context` class and its implementations) |
| 137 | + |
| 138 | +According to the [WCAG 2.1 Understanding Docs](https://www.w3.org/WAI/WCAG21/Understanding/on-focus.html#dfn-changes-of-context), a change in context is a major change that, if made without user awareness, can disorient users who are not able to view the entire page simultaneously. It can include changes of user agent, viewport, focus, or content that changes the meaning of the web page. |
| 139 | + |
| 140 | +::: |
| 141 | + |
| 142 | +#### Example |
| 143 | + |
| 144 | +Consider that a student is on the submission page of an assignment activity called `Kinetics problem set 1` in the `Physics 101` course on the `Mount Orange School` Moodle site. |
| 145 | + |
| 146 | +Then a suitable page title for the page would be something like: |
| 147 | + |
| 148 | +<ValidExample> |
| 149 | + |
| 150 | +The most unique identifying information first represented by the activity name and its sub-page, then followed by broader identifiers such as the course name and the site name. |
| 151 | + |
| 152 | +`Kinetics problem set 1: Submit assignment | Physics 101 | Mount Orange School` |
| 153 | + |
| 154 | +</ValidExample> |
| 155 | + |
| 156 | +<ValidExample> |
| 157 | + |
| 158 | +The most unique identifying information first represented by the name of the sub-page, followed by the activity name that the page belongs to, then followed by broader identifiers such as the course name and the site name. |
| 159 | + |
| 160 | +`Submit assignment | Kinetics problem set 1 | Physics 101 | Mount Orange School` |
| 161 | + |
| 162 | +</ValidExample> |
| 163 | + |
| 164 | +#### Separating components of a page title |
| 165 | + |
| 166 | +When separating the components of the page tile, please use the `moodle_page::TITLE_SEPARATOR` constant. |
| 167 | + |
| 168 | +<ValidExample> |
| 169 | + |
| 170 | +```php |
| 171 | +[$course, $cm] = get_course_and_cm_from_cmid($id); |
| 172 | +// Activity name and its sub-page as the unique identifying information. |
| 173 | +$pagename = format_string($cm->name) . ': ' . get_string('view'); |
| 174 | +// Course name. |
| 175 | +$coursename = format_string($course->fullname); |
| 176 | +// Set the page title, combining the activity page's name and course name using the title separator constant. |
| 177 | +$PAGE->set_title($pagename . moodle_page::TITLE_SEPARATOR . $coursename); |
| 178 | +``` |
| 179 | + |
| 180 | +</ValidExample> |
| 181 | + |
| 182 | +#### Site name on the page title |
| 183 | + |
| 184 | +You should not add the name of the site when setting the page title using `$PAGE->set_title()`. The site name is automatically appended to the end of the page title in the correct format when using `$PAGE->set_title()`. |
| 185 | + |
| 186 | +:::info |
| 187 | + |
| 188 | +Administrators can use the `sitenameinititle` configuration setting to configure how this is shown in the title with possible options including: |
| 189 | + |
| 190 | +- the _full name_ of the site, for example, "Mount Orange School" |
| 191 | +- the _short name_ of the site, for example: "MOS" |
| 192 | + |
| 193 | +This is automatically handled by `$PAGE->set_title()`. |
| 194 | +::: |
| 195 | + |
| 196 | +#### Useful resources |
| 197 | + |
| 198 | +- [Understanding Success Criterion 2.4.2: Page Titled (Level A)](https://www.w3.org/WAI/WCAG21/Understanding/page-titled) |
| 199 | +- [Technique G88: Providing descriptive titles for Web pages](https://www.w3.org/WAI/WCAG21/Techniques/general/G88) |
125 | 200 |
|
126 | 201 | ### Advanced UX Widgets
|
127 | 202 |
|
|
0 commit comments