Skip to content

Commit f4b4a2d

Browse files
authored
Merge pull request #1267 from rdmorganiser/2.3.0-fixes-accessibility
Fix accessibility issues
2 parents e43c392 + d5a91b3 commit f4b4a2d

File tree

89 files changed

+297
-179
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+297
-179
lines changed

rdmo/core/assets/js/components/Html.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { isEmpty } from 'lodash'
55
import { executeScriptTags } from 'rdmo/core/assets/js/utils/meta'
66

77

8-
const Html = ({ html = '' }) => {
8+
const Html = ({ id = null, html = '' }) => {
99
const ref = useRef()
1010

1111
// if html contains a <script> tag, and settings.TEMPLATES_EXECUTE_SCRIPT_TAGS is True,
@@ -27,12 +27,12 @@ const Html = ({ html = '' }) => {
2727
}
2828

2929
return !isEmpty(html) && (
30-
<span ref={ref} dangerouslySetInnerHTML={{ __html: html }} />
30+
<span ref={ref} id={id} dangerouslySetInnerHTML={{ __html: html }} />
3131
)
3232
}
3333

3434
Html.propTypes = {
35-
className: PropTypes.string,
35+
id: PropTypes.string,
3636
html: PropTypes.string
3737
}
3838

rdmo/core/assets/js/components/LinkButton.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ const LinkButton = ({ title, className, disabled=false, onClick, children }) =>
88
}
99

1010
return (
11-
<button title={title} className={'btn-link ' + className} disabled={disabled}
11+
<button type="button" title={title} aria-label={title}
12+
className={'btn-link ' + className} disabled={disabled}
1213
onClick={event => handleClick(event)}>
1314
{children}
1415
</button>

rdmo/core/assets/js/components/SearchField.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,14 @@ const SearchField = ({ value, onChange, onSearch, placeholder }) => {
3232
value={value}
3333
onChange={(e) => handleChange(e.target.value)}
3434
onKeyDown={handleKeyDown}
35+
aria-label={gettext('Search')}
3536
/>
3637
<span className="input-group-btn">
37-
<button className="btn btn-default" onClick={handleButtonClick}>
38+
<button type="button" className="btn btn-default" onClick={handleButtonClick}
39+
title={gettext('Reset')} aria-label={gettext('Reset')}>
3840
<span className="fa fa-times"></span>
3941
</button>
40-
<button className="btn btn-primary" onClick={handleSearch}>
42+
<button type="submit" className="btn btn-primary" onClick={handleSearch}>
4143
{gettext('Search')}
4244
</button>
4345
</span>

rdmo/core/assets/js/containers/Pending.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { isEmpty } from 'lodash'
66
const Pending = ({ pending }) => {
77
return (
88
!isEmpty(pending.items) && (
9-
<i className="fa fa-circle-o-notch fa-spin fa-fw"></i>
9+
<i className="fa fa-circle-o-notch fa-spin fa-fw" aria-hidden="true"></i>
1010
)
1111
)
1212
}

rdmo/core/assets/scss/utils.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
.mt-10 {
1515
margin-top: 10px;
1616
}
17+
.mt-15 {
18+
margin-top: 15px;
19+
}
1720
.mt-20 {
1821
margin-top: 20px;
1922
}
@@ -26,6 +29,9 @@
2629
.mr-10 {
2730
margin-right: 10px;
2831
}
32+
.mr-15 {
33+
margin-right: 15px;
34+
}
2935
.mr-20 {
3036
margin-right: 20px;
3137
}
@@ -38,6 +44,9 @@
3844
.mb-10 {
3945
margin-bottom: 10px;
4046
}
47+
.mb-15 {
48+
margin-bottom: 15px;
49+
}
4150
.mb-20 {
4251
margin-bottom: 20px;
4352
}
@@ -50,6 +59,9 @@
5059
.ml-10 {
5160
margin-left: 10px;
5261
}
62+
.ml-15 {
63+
margin-left: 15px;
64+
}
5365
.ml-20 {
5466
margin-left: 20px;
5567
}

rdmo/core/static/core/css/utils.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
.mt-10 {
1515
margin-top: 10px;
1616
}
17+
.mt-15 {
18+
margin-top: 15px;
19+
}
1720
.mt-20 {
1821
margin-top: 20px;
1922
}
@@ -26,6 +29,9 @@
2629
.mr-10 {
2730
margin-right: 10px;
2831
}
32+
.mr-15 {
33+
margin-right: 15px;
34+
}
2935
.mr-20 {
3036
margin-right: 20px;
3137
}
@@ -38,6 +44,9 @@
3844
.mb-10 {
3945
margin-bottom: 10px;
4046
}
47+
.mb-15 {
48+
margin-bottom: 15px;
49+
}
4150
.mb-20 {
4251
margin-bottom: 20px;
4352
}
@@ -50,6 +59,9 @@
5059
.ml-10 {
5160
margin-left: 10px;
5261
}
62+
.ml-15 {
63+
margin-left: 15px;
64+
}
5365
.ml-20 {
5466
margin-left: 20px;
5567
}

rdmo/core/templates/core/base_navigation.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
77
<div class="container">
88
<div class="navbar-header">
9-
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse">
10-
<span class="sr-only">Toggle navigation</span>
9+
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse"
10+
aria-label="{% trans 'Toggle navigation' %}">
1111
<span class="icon-bar"></span>
1212
<span class="icon-bar"></span>
1313
<span class="icon-bar"></span>

rdmo/core/templates/core/bootstrap_form_field.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66

77
{% with field|widget_type as type %}
88

9-
{% if type != 'checkboxinput' %}
10-
<label for="{{ field.id_for_label }}" class="control-label">{{ field.label }}</label>
11-
{% endif%}
9+
{% if type == 'radio' or type == 'checkboxinput' or type == 'checkboxselectmultiple' %}
10+
<strong class="mb-5">{{ field.label }}</strong>
11+
{% else %}
12+
<label for="{{ field.id_for_label }}" class="control-label">{{ field.label }}</label>
13+
{% endif %}
1214

1315
{% if field.help_text %}
1416
<div class="help-block info">

rdmo/core/templates/core/home.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@
1717
<header>
1818
<div class="hidden-xs">
1919
<div class="header-image header-image-0 visible">
20-
<img src="{% static 'core/img/header/library.jpg' %}"></img>
20+
<img src="{% static 'core/img/header/library.jpg' %}" alt="Stockholm Public Library"></img>
2121
<p class="attribution">
2222
<a href="https://www.flickr.com/photos/spam/5086168739">Stockholm Public Library (Samantha Marx)</a> / <a href="https://creativecommons.org/licenses/by/2.0/">CC BY 2.0</a>
2323
</p>
2424
</div>
2525
<div class="header-image header-image-1">
26-
<img src="{% static 'core/img/header/supercomputer.jpg' %}"></img>
26+
<img src="{% static 'core/img/header/supercomputer.jpg' %}" alt="Discover Supercomputer 3"></img>
2727
<p class="attribution">
2828
<a href="https://www.flickr.com/photos/nasa_goddard/6559334541">Discover Supercomputer 3 (NASA Goddard Space Flight Center)</a> / <a href="https://creativecommons.org/licenses/by/2.0/">CC BY 2.0</a>
2929
</p>
3030
</div>
3131
<div class="header-image header-image-2">
32-
<img src="{% static 'core/img/header/collection.jpg' %}"></img>
32+
<img src="{% static 'core/img/header/collection.jpg' %}" alt=">Nasssammlung"></img>
3333
<p class="attribution">
3434
<a href="https://www.flickr.com/photos/bulle_de/9221247815">Nasssammlung (Christopher Bulle)</a> / <a href="https://creativecommons.org/licenses/by/2.0/">CC BY 2.0</a> <!-- spellchecker:disable-line -->
3535
</p>

rdmo/core/templates/core/upload_form.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@
99
<input type="hidden" name="method" value="upload_file" />
1010

1111
<div class="upload-form-field">
12-
<input type="file" name="uploaded_file" {% if upload_accept %}accept="{{ upload_accept }}"{% endif %}/>
12+
<input type="file" name="uploaded_file" aria-label="{% trans 'Upload file' %}"
13+
{% if upload_accept %}accept="{{ upload_accept }}"{% endif %} />
1314
<p>{% trans "Select file" %}</p>
1415
</div>
1516

1617
<div class="sidebar-form-button">
17-
<button type="submit" class="btn btn-primary" title="{% trans 'Upload' %}">
18-
<i class="fa fa-arrow-right"></i>
18+
<button type="submit" class="btn btn-primary" title="{% trans 'Upload' %}" aria-label="{% trans 'Upload' %}">
19+
<i class="fa fa-arrow-right" aria-hidden="true"></i>
1920
</button>
2021
</div>
2122
</form>

0 commit comments

Comments
 (0)