Skip to content

Commit 0f91708

Browse files
Apply Andrew's review suggestions
Co-authored-by: Andrew Lyons <[email protected]>
1 parent 50aaab2 commit 0f91708

File tree

1 file changed

+39
-7
lines changed

1 file changed

+39
-7
lines changed

general/development/policies/accessibility.md

+39-7
Original file line numberDiff line numberDiff line change
@@ -126,40 +126,72 @@ All pages should have a unique title that describes the current page.
126126
Some tips for providing a meaningful page title:
127127

128128
- The page title must be accurate and informative.
129-
- If the page causes a change of context (e.g. a search functionality), it should describe the result or change of context to the user.
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.
130130
- It should be concise.
131131
- If possible, it should uniquely identify the page.
132132
- The most identifying information should come first.
133133

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+
134142
#### Example
135143

136-
Consider that a student in the submission page of an assignment called `Kinetics problem set 1` in the `Physics 101` in the `Moodle University`.
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.
137145

138146
Then a suitable page title for the page would be something like:
139147

140148
<ValidExample>
141149

142150
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.
143151

144-
`Kinetics problem set 1: Submit assignment | Physics 101 | Moodle University`
152+
`Kinetics problem set 1: Submit assignment | Physics 101 | Mount Orange School`
145153

146154
</ValidExample>
147155

148156
<ValidExample>
149157

150-
The most unique identifying information first represented by sub-page's name followed by the activity name that the page belongs to, then followed by broader identifiers such as the course name and the site name.
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.
151159

152-
`Submit assignment | Kinetics problem set 1 | Physics 101 | Moodle University`
160+
`Submit assignment | Kinetics problem set 1 | Physics 101 | Mount Orange School`
153161

154162
</ValidExample>
155163

156164
#### Separating components of a page title
157165

158-
When separating the components of the page tile, please use the `moodle_page:TITLE_SEPARATOR` constant.
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>
159181

160182
#### Site name on the page title
161183

162-
There's no need to add the site's name when setting the page title using `$PAGE->set_title()`. The site name is automatically appended at the end of the page title by default by `$PAGE->set_title()`. The displayed site name on the page title will depend on the admin setting `$CFG->sitenameintitle` whether it's set to show the site's full name or the site's short name.
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+
:::
163195

164196
#### Useful resources
165197

0 commit comments

Comments
 (0)