@ons/design-system 54.0.1 → 55.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/components/button/_button.scss +20 -6
  2. package/components/button/_macro.njk +1 -1
  3. package/components/button/_macro.spec.js +2 -2
  4. package/components/checkboxes/_checkbox.scss +43 -10
  5. package/components/collapsible/_collapsible.scss +2 -1
  6. package/components/document-list/document-list.scss +2 -0
  7. package/components/download-resources/download-resources.js +19 -0
  8. package/components/download-resources/download-resources.spec.js +95 -0
  9. package/components/external-link/_macro.njk +1 -1
  10. package/components/external-link/_macro.spec.js +2 -2
  11. package/components/fieldset/_fieldset.scss +11 -1
  12. package/components/fieldset/_macro.njk +9 -8
  13. package/components/fieldset/_macro.spec.js +27 -5
  14. package/components/footer/_footer.scss +1 -0
  15. package/components/header/_macro.njk +2 -5
  16. package/components/header/_macro.spec.js +0 -16
  17. package/components/hero/_macro.njk +1 -1
  18. package/components/hero/_macro.spec.js +1 -1
  19. package/components/icons/_macro.njk +1 -1
  20. package/components/input/_input-type.scss +3 -0
  21. package/components/input/_input.scss +13 -2
  22. package/components/label/_label.scss +1 -1
  23. package/components/label/_macro.njk +27 -15
  24. package/components/label/_macro.spec.js +31 -0
  25. package/components/lists/_macro.njk +1 -1
  26. package/components/lists/_macro.spec.js +2 -2
  27. package/components/message/_message.scss +1 -0
  28. package/components/modal/_macro.njk +2 -2
  29. package/components/modal/_modal.scss +10 -9
  30. package/components/navigation/_macro.njk +0 -1
  31. package/components/navigation/_macro.spec.js +0 -1
  32. package/components/pagination/_pagination.scss +1 -0
  33. package/components/panel/_macro.njk +6 -7
  34. package/components/panel/_macro.spec.js +23 -20
  35. package/components/panel/_panel.scss +13 -5
  36. package/components/phase-banner/_phase-banner.scss +1 -0
  37. package/components/radios/_radio.scss +15 -3
  38. package/components/reply/_macro.njk +2 -2
  39. package/components/skip-to-content/_skip.scss +2 -1
  40. package/components/table/_macro.njk +3 -2
  41. package/components/table/_macro.spec.js +0 -27
  42. package/components/table/_table.scss +13 -6
  43. package/components/table/sortable-table.js +1 -0
  44. package/components/tabs/_tabs.scss +5 -3
  45. package/css/census.css +1 -1
  46. package/css/ids.css +1 -1
  47. package/css/main.css +1 -1
  48. package/layout/_template.njk +8 -8
  49. package/package.json +1 -1
  50. package/scripts/main.es5.js +1 -1
  51. package/scripts/main.js +1 -1
  52. package/scss/base/_global.scss +1 -0
  53. package/scss/overrides/hcm.scss +205 -46
  54. package/scss/patternlib.scss +1 -0
@@ -16,12 +16,14 @@
16
16
  &:focus {
17
17
  // Overide default input focus so it can wrap prefix/suffix too
18
18
  box-shadow: none;
19
+ outline: none;
19
20
  }
20
21
 
21
22
  // Overide default input error style so it can wrap prefix/suffix too
22
23
  &.ons-input--error:not(:focus) {
23
24
  border-right: $input-border-width solid $color-input-border;
24
25
  box-shadow: none;
26
+ outline: none;
25
27
  }
26
28
  }
27
29
 
@@ -101,6 +103,7 @@
101
103
  content: '';
102
104
  display: block;
103
105
  left: 0;
106
+ outline: 1px solid transparent; // Add transparent outline because Windows High Contrast Mode doesn't show box-shadows
104
107
  position: absolute;
105
108
  right: 0;
106
109
  top: 0;
@@ -1,6 +1,14 @@
1
1
  %ons-input-focus {
2
2
  box-shadow: 0 0 0 $input-border-width $color-input-border, 0 0 0 4px $color-focus;
3
- outline: none;
3
+
4
+ // Add transparent outline because Windows High Contrast Mode doesn't show box-shadows
5
+ outline: 3px solid transparent;
6
+ outline-offset: 1px;
7
+
8
+ @media screen and (forced-colors: active) {
9
+ // To better match the focus states of native controls
10
+ outline-color: Highlight;
11
+ }
4
12
  }
5
13
 
6
14
  .ons-input {
@@ -47,6 +55,7 @@
47
55
  &--error:not(:focus) {
48
56
  border: $input-border-width solid $color-errors;
49
57
  box-shadow: 0 0 0 $input-border-width $color-errors;
58
+ outline: 1px solid transparent; // Add transparent outline because Windows High Contrast Mode doesn't show box-shadows
50
59
  }
51
60
 
52
61
  &--with-description {
@@ -73,7 +82,9 @@
73
82
 
74
83
  .ons-input--select {
75
84
  appearance: none;
76
- background: $color-input-bg url('#{$static}/img/icons--chevron-down.svg') no-repeat center right 10px;
85
+ background: $color-input-bg
86
+ url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 11.75 7.7'%3E%3Cpath fill='currentColor' d='m1.37.15 4.5 5.1 4.5-5.1a.37.37 0 0 1 .6 0l.7.7a.45.45 0 0 1 0 .5l-5.5 6.2a.37.37 0 0 1-.6 0l-5.5-6.1a.64.64 0 0 1 0-.6l.7-.7a.64.64 0 0 1 .6 0Z'/%3E%3C/svg%3E")
87
+ no-repeat center right 10px;
77
88
  background-size: 1rem;
78
89
  line-height: 1.3rem;
79
90
  padding: 0.39rem 2rem 0.39rem $input-padding-horizontal;
@@ -19,7 +19,7 @@
19
19
  &--placeholder {
20
20
  font-size: 1rem;
21
21
  font-weight: $font-weight-regular;
22
- left: 8px;
22
+ left: 10px;
23
23
  position: absolute;
24
24
  top: 6px;
25
25
  }
@@ -1,32 +1,44 @@
1
1
  {% macro onsLabel(params) %}
2
- {% set field -%}
3
- <span
4
- {% if params.id is defined and params.id %} id="{{ params.id }}-description-hint"{% else %}id="description-hint"{% endif %}
5
- class="ons-label__description {% if params.inputType is defined and params.inputType %}ons-{{ params.inputType }}__label--with-description{% else %} ons-input--with-description{% endif %}">
2
+ {% if params.id %}
3
+ {% set descriptionID = params.id ~ "-description-hint" %}
4
+ {% else %}
5
+ {% set descriptionID = "description-hint" %}
6
+ {% endif %}
7
+
8
+ {% if params.inputType == "checkbox" or params.inputType == "radio" %}
9
+ {% set isCheckboxOrRadio = true %}
10
+ {% else %}
11
+ {% set isCheckboxOrRadio = false %}
12
+ {% endif %}
13
+
14
+ {% set description -%}
15
+ <span{% if isCheckboxOrRadio == false %} id="{{ descriptionID }}"{% endif %} class="ons-label__description {% if params.inputType %}ons-{{ params.inputType }}__label--with-description{% else %} ons-input--with-description{% endif %}">
6
16
  {{- params.description -}}
7
17
  </span>
8
18
  {%- endset %}
9
19
 
10
20
  <label
11
- class="{% if params.inputType is not defined -%}ons-label{%- endif %}{{- ' ' + params.classes if params.classes else "" -}}{%- if params.description is defined and params.description %} ons-label--with-description{%- endif %} {{- ' ons-label--placeholder' if params.accessiblePlaceholder else "" -}}"
12
- {% if params.for is defined and params.for %} for="{{ params.for }}"{% endif %}
13
- {% if params.id is defined and params.id %} id="{{ params.id }}"{% endif %}
14
- {% if params.attributes is defined and params.attributes %}{% for attribute, value in (params.attributes.items() if params.attributes is mapping and params.attributes.items else params.attributes) %}{{ attribute }}{% if value is defined and value %}="{{ value }}"{% endif %}{% endfor %}{% endif %}
21
+ class="{% if params.inputType is not defined -%}ons-label{%- endif %}{{- ' ' + params.classes if params.classes else "" -}}{%- if params.description %} ons-label--with-description{%- endif %} {{- ' ons-label--placeholder' if params.accessiblePlaceholder else "" -}}"
22
+ {% if params.description %}aria-describedby="{{ descriptionID }}"{% endif %}
23
+ {% if params.for %} for="{{ params.for }}"{% endif %}
24
+ {% if params.id %} id="{{ params.id }}"{% endif %}
25
+ {% if params.attributes %}{% for attribute, value in (params.attributes.items() if params.attributes is mapping and params.attributes.items else params.attributes) %}{{ attribute }}{% if value is defined and value %}="{{ value }}"{% endif %}{% endfor %}{% endif %}
15
26
  >
16
27
 
17
28
  {{- params.text | safe -}}
18
29
 
19
- {%- if params.inputType is defined and params.inputType -%}
20
- {% if params.inputType == "checkbox" or params.inputType == "radio" -%}
21
- {%- if params.description is defined and params.description -%}
22
- {{- field | safe -}}
23
- {%- endif -%}
30
+ {%- if isCheckboxOrRadio == true -%}
31
+ {%- if params.description -%}
32
+ <span class="ons-label__aria-hidden-description" aria-hidden="true">{{- description | safe -}}</span>
24
33
  {%- endif -%}
25
34
  </label>
35
+ {% if isCheckboxOrRadio == true and params.description -%}
36
+ <span class="ons-label__visually-hidden-description ons-u-vh" id="{{ descriptionID }}">{{- params.description -}}</span>
37
+ {%- endif -%}
26
38
  {%- else -%}
27
39
  </label>
28
- {%- if params.description is defined and params.description -%}
29
- {{- field | safe -}}
40
+ {%- if params.description -%}
41
+ {{- description | safe -}}
30
42
  {%- endif -%}
31
43
  {%- endif %}
32
44
  {% endmacro %}
@@ -53,6 +53,12 @@ describe('macro: label', () => {
53
53
  expect($('.ons-label').attr('for')).toBe('some-input');
54
54
  });
55
55
 
56
+ it('has `aria-describedby` and correct value when description is provided', () => {
57
+ const $ = cheerio.load(renderComponent('label', EXAMPLE_LABEL_WITH_DESCRIPTION));
58
+
59
+ expect($('.ons-label').attr('aria-describedby')).toBe('example-label-description-hint');
60
+ });
61
+
56
62
  it.each([
57
63
  ['`inputType` parameter is not provided', EXAMPLE_LABEL, true],
58
64
  ['`inputType` parameter is provided', EXAMPLE_LABEL_WITH_INPUT_TYPE, false],
@@ -185,5 +191,30 @@ describe('macro: label', () => {
185
191
  expect($('.ons-label__description').hasClass(expectedInputSpecificModifier)).toBe(true);
186
192
  expect($('.ons-label__description').hasClass('ons-input--with-description')).toBe(false);
187
193
  });
194
+
195
+ it.each([['checkbox'], ['radio']])('has the description in an `aria-hidden` element when "%s" `inputType` is provided', inputType => {
196
+ const $ = cheerio.load(
197
+ renderComponent('label', {
198
+ ...EXAMPLE_LABEL_WITH_DESCRIPTION,
199
+ inputType,
200
+ }),
201
+ );
202
+
203
+ expect($('.ons-label__aria-hidden-description').attr('aria-hidden')).toBe('true');
204
+ });
205
+
206
+ it.each([['checkbox'], ['radio']])(
207
+ 'has a duplicate description in a visually hidden element when "%s" `inputType` is provided',
208
+ inputType => {
209
+ const $ = cheerio.load(
210
+ renderComponent('label', {
211
+ ...EXAMPLE_LABEL_WITH_DESCRIPTION,
212
+ inputType,
213
+ }),
214
+ );
215
+
216
+ expect($('.ons-label__visually-hidden-description').hasClass('ons-u-vh')).toBe(true);
217
+ },
218
+ );
188
219
  });
189
220
  });
@@ -62,7 +62,7 @@
62
62
  {%- else -%}
63
63
  <a href="{{ item.url }}" class="ons-list__link{% if item.variants == 'inPageLink' %} ons-js-inpagelink{% endif %}{% if item.classes is defined and item.classes %} {{ item.classes }}{% endif %}"{% if item.target is defined and item.target %} target="{{ item.target }}"{% endif %}{% if item.attributes is defined and item.attributes %}{% for attribute, value in (item.attributes.items() if item.attributes is mapping and item.attributes.items else item.attributes) %} {{ attribute }}{% if value is defined and value %}="{{ value }}"{% endif %}{% endfor %}{% endif %}>
64
64
  {%- if item.prefix is defined and item.prefix -%}<span class="ons-u-vh">{{- item.prefix -}}</span>{%- endif -%} {{- itemText | safe -}}
65
- {%- if item.target is defined and item.target == "_blank" -%}<span class="ons-u-vh">{{- item.screenreaderMessage | default("this link will open in a new tab") -}}</span>{%- endif -%}
65
+ {%- if item.target is defined and item.target == "_blank" -%}<span class="ons-u-vh"> ({{- item.screenreaderMessage | default("opens in a new tab") -}})</span>{%- endif -%}
66
66
  </a>
67
67
  {%- endif -%}
68
68
  {%- else -%}
@@ -331,7 +331,7 @@ describe('macro: lists', () => {
331
331
  }),
332
332
  );
333
333
 
334
- expect($('.ons-list__link .ons-u-vh').text()).toBe('opens in a new tab');
334
+ expect($('.ons-list__link .ons-u-vh').text()).toBe(' (opens in a new tab)');
335
335
  });
336
336
 
337
337
  it('renders a default visually hidden screen reader message when target is "_blank"', () => {
@@ -347,7 +347,7 @@ describe('macro: lists', () => {
347
347
  }),
348
348
  );
349
349
 
350
- expect($('.ons-list__link .ons-u-vh').text()).toBe('this link will open in a new tab');
350
+ expect($('.ons-list__link .ons-u-vh').text()).toBe(' (opens in a new tab)');
351
351
  });
352
352
 
353
353
  it('has additionally provided `attributes`', () => {
@@ -3,6 +3,7 @@
3
3
  .ons-message {
4
4
  border-radius: math.div($grid-gutters, 2);
5
5
  margin-bottom: 2rem;
6
+ outline: 1px solid transparent; // Add transparent outline because Windows High Contrast Mode doesn't show background
6
7
 
7
8
  &--sent {
8
9
  background: $color-info-tint;
@@ -7,9 +7,9 @@
7
7
  {% if params.attributes is defined and params.attributes %}{% for attribute, value in (params.attributes.items() if params.attributes is mapping and params.attributes.items else params.attributes) %} {{attribute}}="{{value}}"{% endfor %}{% endif %}
8
8
  >
9
9
  <div class="ons-modal__content">
10
- <h1 id="ons-modal-title" class="ons-modal__title">
10
+ <h2 id="ons-modal-title" class="ons-modal__title">
11
11
  {{ params.title }}
12
- </h1>
12
+ </h2>
13
13
  <div class="ons-modal__body">
14
14
  {{ (params.body if params.body is defined and params.body else "") | safe }}{{ caller() if caller }}
15
15
  </div>
@@ -5,12 +5,19 @@ $backdrop-colour: rgba(0, 0, 0, 0.8);
5
5
  border-radius: 0.4rem;
6
6
  box-shadow: 0 0 7px 0 #000;
7
7
  display: none;
8
+ left: 0;
8
9
  margin-left: 2rem;
9
10
  margin-right: 2rem;
10
- max-width: 500px;
11
+ outline: 2px solid transparent; // Add transparent outline because Windows High Contrast Mode doesn't show box-shadows
11
12
  padding: 2rem;
12
- position: relative;
13
- width: auto;
13
+ position: fixed;
14
+ top: 0;
15
+
16
+ @media screen and (min-width: 600px) {
17
+ margin-left: auto;
18
+ margin-right: auto;
19
+ max-width: 500px;
20
+ }
14
21
 
15
22
  &-ie11 & {
16
23
  background: $color-white;
@@ -23,12 +30,6 @@ $backdrop-colour: rgba(0, 0, 0, 0.8);
23
30
  transform: translate(0, -50%);
24
31
  }
25
32
 
26
- @media screen and (min-width: 600px) {
27
- margin-left: auto;
28
- margin-right: auto;
29
- width: 100%;
30
- }
31
-
32
33
  &::backdrop {
33
34
  backdrop-filter: blur(3px);
34
35
  background: $backdrop-colour;
@@ -69,7 +69,6 @@
69
69
  "attributes": {
70
70
  "aria-label": "Toggle section navigation",
71
71
  "aria-controls": params.navigation.subNavigation.id,
72
- "aria-haspopup": "true",
73
72
  "aria-expanded": "false"
74
73
  }
75
74
  }) }}
@@ -211,7 +211,6 @@ describe('macro: navigation', () => {
211
211
  attributes: {
212
212
  'aria-label': 'Toggle section navigation',
213
213
  'aria-controls': 'sub-nav',
214
- 'aria-haspopup': 'true',
215
214
  'aria-expanded': 'false',
216
215
  },
217
216
  });
@@ -45,6 +45,7 @@ $pagination-item-width: 2.5rem;
45
45
  &__item--current &__link {
46
46
  background: $color-text-link-hover;
47
47
  color: $color-white;
48
+ outline: 2px solid transparent; // Add transparent outline because Windows High Contrast Mode doesn't show backgrounds
48
49
  text-decoration: none;
49
50
  }
50
51
 
@@ -15,7 +15,7 @@
15
15
  {% endif %}
16
16
 
17
17
  {% if params is defined and params.type == "warn-branded" %}
18
- {% set containerClass = 'ons-census-warning' %}
18
+ {% set containerClass = 'ons-branded-warning' %}
19
19
  {% endif %}
20
20
 
21
21
  {% if params is defined and params.type == "announcement" %}
@@ -31,7 +31,7 @@
31
31
  <div class="ons-container">
32
32
  {% endif %}
33
33
 
34
- <div {% if params is defined and params and params.type == 'error' and params.title is defined and params.title %}aria-labelledby="error-summary-title" role="alert" tabindex="-1" {% if params.dsExample != true %}autofocus="autofocus" {% endif %}{% endif %}class="ons-panel{{ typeClass }}{{ iconClass }}{{ noTitleClass }}{{ spaciousClass }}{{ classes }}"{% if params is defined and params and params.attributes is defined and params.attributes %}{% for attribute, value in (params.attributes.items() if params is defined and params and params.attributes is mapping and params.attributes.items is defined and params.attributes.items else params.attributes) %}{{attribute}}="{{value}}" {% endfor %}{% endif %}{% if params is defined and params and params.id is defined and params.id %} id="{{params.id}}"{% endif %}>
34
+ <div {% if params is defined and params and (params.type == 'error' or params.type == 'success') %}aria-labelledby="alert" role="alert" tabindex="-1" {% if params.dsExample != true %}autofocus="autofocus" {% endif %}{% endif %}class="ons-panel{{ typeClass }}{{ iconClass }}{{ noTitleClass }}{{ spaciousClass }}{{ classes }}"{% if params is defined and params and params.attributes is defined and params.attributes %}{% for attribute, value in (params.attributes.items() if params is defined and params and params.attributes is mapping and params.attributes.items is defined and params.attributes.items else params.attributes) %}{{attribute}}="{{value}}" {% endfor %}{% endif %}{% if params is defined and params and params.id is defined and params.id %} id="{{params.id}}"{% endif %}>
35
35
 
36
36
  {% if params is defined and params and params.type == "warn" or params.type == "warn-branded" %}
37
37
  <span class="ons-panel__icon" aria-hidden="true">!</span>
@@ -59,16 +59,15 @@
59
59
  {% endif %}
60
60
  {% set titleTag = params.titleTag | default(defaultTitleTag) %}
61
61
  <div class="ons-panel__header">
62
- <{{ titleTag }} id="error-summary-title" {% if params is defined and params and params.type is defined and params.type %}data-qa="{{ params.type }}-header"{% endif %} class="ons-panel__title ons-u-fs-r--b">{{ params.title | safe }}</{{ titleTag }}>
62
+ <{{ titleTag }} id="alert" {% if params is defined and params and params.type is defined and params.type %}data-qa="{{ params.type }}-header"{% endif %} class="ons-panel__title ons-u-fs-r--b">{{ params.title | safe }}</{{ titleTag }}>
63
63
  </div>
64
64
  {% else %}
65
65
  {% if params.type is not defined or params.type == "branded" or params.type == "info" %}
66
66
  <span class="ons-panel__assistive-text ons-u-vh">{{ params.assistiveTextPrefix | default("Important information: ") }}</span>
67
67
  {% else %}
68
- {% if params.type is defined and params.type == "success" %}
69
- <span class="ons-panel__assistive-text ons-u-vh">{{ params.assistiveTextPrefix | default("Completed: ") }}</span>
70
- {% elif params.type is defined and params.type == "error" %}
71
- <span class="ons-panel__assistive-text ons-u-vh">{{ params.assistiveTextPrefix | default("Error: ") }}</span>
68
+ {% if params.type is defined and (params.type == "success" or params.type == "error") %}
69
+ {% set defaultText = "Completed" if params.type == "success" else "Error" %}
70
+ <span id="alert" class="ons-panel__assistive-text ons-u-vh">{{ params.assistiveTextPrefix | default(defaultText ~ ": ") }}</span>
72
71
  {% endif %}
73
72
  {% endif %}
74
73
  {% endif %}
@@ -186,50 +186,53 @@ describe('macro: panel', () => {
186
186
  });
187
187
  });
188
188
 
189
- describe('mode: error', () => {
189
+ describe.each([
190
+ ['error', 'h2'],
191
+ ['success', 'div'],
192
+ ])('mode: %s', (panelType, tagEl) => {
190
193
  it('has the default id set', () => {
191
194
  const $ = cheerio.load(
192
195
  renderComponent('panel', {
193
196
  ...EXAMPLE_PANEL_BASIC,
194
- title: 'Error title',
195
- type: 'error',
197
+ title: 'Title',
198
+ type: panelType,
196
199
  }),
197
200
  );
198
201
 
199
- expect($('#error-summary-title').length).toBe(1);
202
+ expect($('#alert').length).toBe(1);
200
203
  });
201
204
 
202
- it('has H2 as the default title tag', () => {
205
+ it('has the correct default title tag', () => {
203
206
  const $ = cheerio.load(
204
207
  renderComponent('panel', {
205
208
  ...EXAMPLE_PANEL_BASIC,
206
- title: 'Error title',
207
- type: 'error',
209
+ title: 'Title',
210
+ type: panelType,
208
211
  }),
209
212
  );
210
213
 
211
214
  const titleTag = $('.ons-panel__title')[0].tagName;
212
- expect(titleTag).toBe('h2');
215
+ expect(titleTag).toBe(tagEl);
213
216
  });
214
217
 
215
218
  it('has aria-labelledby attribute set with default value', () => {
216
219
  const $ = cheerio.load(
217
220
  renderComponent('panel', {
218
221
  ...EXAMPLE_PANEL_BASIC,
219
- title: 'Error title',
220
- type: 'error',
222
+ title: 'Title',
223
+ type: panelType,
221
224
  }),
222
225
  );
223
226
 
224
- expect($('.ons-panel').attr('aria-labelledby')).toBe('error-summary-title');
227
+ expect($('.ons-panel').attr('aria-labelledby')).toBe('alert');
225
228
  });
226
229
 
227
230
  it('has the role attribute set to alert', () => {
228
231
  const $ = cheerio.load(
229
232
  renderComponent('panel', {
230
233
  ...EXAMPLE_PANEL_BASIC,
231
- title: 'Error title',
232
- type: 'error',
234
+ title: 'Title',
235
+ type: panelType,
233
236
  }),
234
237
  );
235
238
 
@@ -240,8 +243,8 @@ describe('macro: panel', () => {
240
243
  const $ = cheerio.load(
241
244
  renderComponent('panel', {
242
245
  ...EXAMPLE_PANEL_BASIC,
243
- title: 'Error title',
244
- type: 'error',
246
+ title: 'Title',
247
+ type: panelType,
245
248
  }),
246
249
  );
247
250
 
@@ -252,8 +255,8 @@ describe('macro: panel', () => {
252
255
  const $ = cheerio.load(
253
256
  renderComponent('panel', {
254
257
  ...EXAMPLE_PANEL_BASIC,
255
- title: 'Error title',
256
- type: 'error',
258
+ title: 'Title',
259
+ type: panelType,
257
260
  }),
258
261
  );
259
262
 
@@ -264,8 +267,8 @@ describe('macro: panel', () => {
264
267
  const $ = cheerio.load(
265
268
  renderComponent('panel', {
266
269
  ...EXAMPLE_PANEL_BASIC,
267
- title: 'Error title',
268
- type: 'error',
270
+ title: 'Title',
271
+ type: panelType,
269
272
  dsExample: true,
270
273
  }),
271
274
  );
@@ -352,7 +355,7 @@ describe('macro: panel', () => {
352
355
  }),
353
356
  );
354
357
 
355
- expect($('.ons-census-warning').length).toBe(1);
358
+ expect($('.ons-branded-warning').length).toBe(1);
356
359
  expect($('.ons-container').length).toBe(1);
357
360
  });
358
361
 
@@ -3,6 +3,7 @@
3
3
  &--#{$name} {
4
4
  background: $color-bg;
5
5
  border-color: $color;
6
+ outline: 1px solid transparent; // Add transparent outline because Windows High Contrast Mode doesn't show background
6
7
  }
7
8
 
8
9
  &--#{$name} & {
@@ -13,7 +14,7 @@
13
14
  }
14
15
  }
15
16
 
16
- .ons-census-warning {
17
+ .ons-branded-warning {
17
18
  background: $color-branded-tertiary;
18
19
  }
19
20
 
@@ -21,6 +22,11 @@
21
22
  background-color: $color-black;
22
23
  }
23
24
 
25
+ .ons-branded-warning,
26
+ .ons-announcement {
27
+ outline: 2px solid transparent; // Add transparent outline because Windows High Contrast Mode doesn't show background
28
+ }
29
+
24
30
  .ons-panel {
25
31
  border-radius: 0;
26
32
  position: relative;
@@ -37,12 +43,11 @@
37
43
  &:focus {
38
44
  box-shadow: none;
39
45
  outline: 4px solid $color-focus !important;
40
- outline-offset: 0;
41
46
  }
42
47
 
43
48
  &__header {
44
49
  border-radius: 0;
45
- color: $color-white;
50
+ color: $color-text-inverse;
46
51
  margin: 0;
47
52
  padding: 0.75rem 1rem;
48
53
  }
@@ -111,6 +116,7 @@
111
116
  &--warn {
112
117
  border: 0 !important;
113
118
  margin-bottom: 1rem;
119
+ outline: none !important;
114
120
  padding: 0;
115
121
 
116
122
  &--footer {
@@ -125,6 +131,7 @@
125
131
  border: 0 !important;
126
132
  color: $color-white;
127
133
  margin-bottom: 0;
134
+ outline: none !important;
128
135
  padding: 1rem 0 !important;
129
136
  a {
130
137
  color: inherit;
@@ -137,7 +144,7 @@
137
144
 
138
145
  &--announcement {
139
146
  a:focus {
140
- box-shadow: 0 -2px #fd0, 0 4px #fd0 !important; // Override focus style because the black border is not visible on a black background
147
+ box-shadow: 0 -2px $color-focus, 0 4px $color-text-inverse-link !important; // Override focus style because the black border is not visible on a black background
141
148
  }
142
149
  }
143
150
 
@@ -178,6 +185,7 @@
178
185
  line-height: 2rem;
179
186
  min-height: 2rem;
180
187
  min-width: 2rem;
188
+ outline: 2px solid transparent; // Add transparent outline because Windows High Contrast Mode doesn't show background
181
189
  text-align: center;
182
190
  }
183
191
  }
@@ -245,6 +253,6 @@
245
253
  @include panel-type(success, $color-success, $color-success-tint);
246
254
  @include panel-type(info, $color-info, $color-info-tint);
247
255
  @include panel-type(branded, $color-branded, $color-branded-tint);
248
- @include panel-type(warn, $color-white, $color-white);
256
+ @include panel-type(warn, transparent, transparent);
249
257
  @include panel-type(warn-branded, $color-branded-tertiary, $color-branded-tertiary);
250
258
  @include panel-type(announcement, $color-black, $color-black);
@@ -8,6 +8,7 @@
8
8
  font-size: 0.85rem;
9
9
  line-height: 1em;
10
10
  margin: 0 0.5rem 0 0;
11
+ outline: 2px solid transparent; // Add transparent outline because Windows High Contrast Mode doesn't show background
11
12
  padding: 0.4rem;
12
13
  text-transform: uppercase;
13
14
  }
@@ -6,15 +6,22 @@
6
6
 
7
7
  background: $color-grey-5;
8
8
  border-radius: 50%;
9
- box-shadow: inset 0 0 0 3px $color-white;
9
+ box-shadow: inset 0 0 0 3px $color-input-bg;
10
10
 
11
- &:checked {
12
- background: $color-input-border;
11
+ &::after {
12
+ border-color: $color-input-border;
13
+ border-radius: 50%;
14
+ border-width: 6px;
15
+ height: 0;
16
+ left: 3px;
17
+ top: 3px;
18
+ width: 0;
13
19
  }
14
20
  }
15
21
 
16
22
  &.ons-radio--no-border {
17
23
  @extend .ons-checkbox--no-border;
24
+
18
25
  & > .ons-radio__input {
19
26
  @extend .ons-radio__input;
20
27
  &:focus,
@@ -23,6 +30,7 @@
23
30
  background: none;
24
31
  border: none;
25
32
  box-shadow: none;
33
+ outline: none;
26
34
  }
27
35
  }
28
36
 
@@ -30,6 +38,10 @@
30
38
  box-shadow: inset 0 0 0 3px $color-input-bg, 0 0 0 $input-border-width $color-input-border, 0 0 0 4px $color-focus;
31
39
  }
32
40
  }
41
+
42
+ .ons-radio__label--with-description {
43
+ padding: 0;
44
+ }
33
45
  }
34
46
 
35
47
  &__label {
@@ -12,7 +12,7 @@
12
12
  })
13
13
  }}
14
14
  <div class="ons-grid ons-grid--flex ons-grid--gutterless ons-grid--vertical-center ons-grid--no-wrap@s ons-u-mt-m ons-u-mb-m">
15
- <div class="ons-grid__col">
15
+ <div class="ons-grid__col ons-u-mr-m ons-u-mb-s">
16
16
  {{
17
17
  onsButton({
18
18
  "id": params.button.id,
@@ -22,7 +22,7 @@
22
22
  })
23
23
  }}
24
24
  </div>
25
- <div class="ons-grid__col ons-u-ml-m">
25
+ <div class="ons-grid__col ons-u-mb-s">
26
26
  <a class="ons-reply__link" href="{{ params.closeLinkUrl }}">{{ params.closeLinkText }}</a>
27
27
  </div>
28
28
  </div>
@@ -21,7 +21,8 @@
21
21
  height: auto;
22
22
  margin: inherit;
23
23
  max-height: 20em;
24
- outline: none;
24
+ outline: 3px solid transparent; // Add transparent outline because Windows High Contrast Mode doesn't show box-shadows
25
+ outline-offset: -4px;
25
26
  overflow: visible;
26
27
  padding: 1rem;
27
28
  position: static;
@@ -16,12 +16,13 @@
16
16
  <tr class="ons-table__row">
17
17
  {% for th in params.ths %}
18
18
  <th scope="col" class="ons-table__header{{ ' ' + th.thClasses if th.thClasses is defined and th.thClasses }}{{ " ons-table__header--numeric" if th.numeric is defined and th.numeric }}"{% if 'sortable' in variants %} aria-sort="{{- th.ariaSort | default('none') -}}"{% endif %}>
19
- <span {% if 'sortable' in variants %}class="ons-u-vh"{% endif %}>{{- th.value -}}</span>
19
+ <span>{{- th.value -}}</span>
20
20
  {% if 'sortable' in variants %}
21
21
  {{
22
22
  onsIcon({
23
23
  "iconType": "sort-sprite",
24
- "id": th.value
24
+ "id": th.value,
25
+ "classes": 'ons-u-d-no'
25
26
  })
26
27
  }}
27
28
  {% endif %}
@@ -480,33 +480,6 @@ describe('macro: table', () => {
480
480
 
481
481
  expect($('.ons-table').attr('data-aria-desc')).toBe('descending');
482
482
  });
483
-
484
- it('adds visually hidden class to column headers', () => {
485
- const $ = cheerio.load(renderComponent('table', params));
486
-
487
- const hasClass = mapAll($('.ons-table__header > span'), node => node.hasClass('ons-u-vh'));
488
- expect(hasClass).toEqual([true, true, true]);
489
- });
490
-
491
- it('renders "sort-sprite" icon for each column header', () => {
492
- const faker = templateFaker();
493
- const iconsSpy = faker.spy('icons');
494
-
495
- faker.renderComponent('table', params);
496
-
497
- expect(iconsSpy.occurrences[0]).toEqual({
498
- iconType: 'sort-sprite',
499
- id: 'Column 1',
500
- });
501
- expect(iconsSpy.occurrences[1]).toEqual({
502
- iconType: 'sort-sprite',
503
- id: 'Column 2',
504
- });
505
- expect(iconsSpy.occurrences[2]).toEqual({
506
- iconType: 'sort-sprite',
507
- id: 'Column 3',
508
- });
509
- });
510
483
  });
511
484
 
512
485
  describe('table caption', () => {