Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Commit 0f71bc9

Browse files
author
george
committed
[142] Make component widths accessible in text zoom mode
1 parent f110784 commit 0f71bc9

File tree

6 files changed

+30
-17
lines changed

6 files changed

+30
-17
lines changed

app/components/SideNav/styles.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
.side-nav-menu {
4646
h4 {
4747
color: $black;
48-
font-size: 18px;
4948
font-weight: $global-font-weight-bold;
5049
}
5150

src/js/__tests__/__snapshots__/accordion.spec.js.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ exports[`Accordions #render -> Accordion Button Click (no toggle multiple) opens
101101
aria-labelledby="button-2"
102102
class="accordion-content"
103103
id="content-2"
104-
style="max-height: 0px;"
104+
style="max-height: 0em;"
105105
>
106106
107107
@@ -177,7 +177,7 @@ exports[`Accordions #render -> Accordion Button Click (toggle multiple) opens cl
177177
aria-labelledby="button-1"
178178
class="accordion-content"
179179
id="content-1"
180-
style="max-height: 0px;"
180+
style="max-height: 0em;"
181181
>
182182
183183
@@ -236,7 +236,7 @@ exports[`Accordions #render -> Accordion Button Click (toggle multiple) opens cl
236236
aria-labelledby="button-2"
237237
class="accordion-content"
238238
id="content-2"
239-
style="max-height: 0px;"
239+
style="max-height: 0em;"
240240
>
241241
242242
@@ -311,7 +311,7 @@ exports[`Accordions API start sets attributes 1`] = `
311311
aria-labelledby="button-1"
312312
class="accordion-content"
313313
id="content-1"
314-
style="max-height: 0px;"
314+
style="max-height: 0em;"
315315
>
316316
317317

src/js/accordion.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ const Messages = {
3333
`Could not find accordion content block with id '${id}'; should match trigger with [data-target='${id}'].`,
3434
}
3535

36+
const BASE_FONT_SIZE = 16
37+
3638
export default class Accordion {
3739
constructor() {
3840
// events
@@ -125,7 +127,7 @@ export default class Accordion {
125127
}
126128

127129
if (contentShouldExpand === "true") {
128-
dom.css(buttonContent, "maxHeight", `${buttonContent.scrollHeight}px`)
130+
dom.css(buttonContent, "maxHeight", `${buttonContent.scrollHeight / BASE_FONT_SIZE}em`)
129131
dom.setAttr(instance, Selectors.ARIA_EXPANDED, "true")
130132
dom.setAttr(buttonContent, Selectors.ARIA_HIDDEN, "false")
131133

@@ -235,7 +237,11 @@ export default class Accordion {
235237
if (dom.css(this._activeContent, "maxHeight")) {
236238
dom.css(this._activeContent, "maxHeight", null)
237239
} else {
238-
dom.css(this._activeContent, "maxHeight", `${this._activeContent.scrollHeight}px`)
240+
dom.css(
241+
this._activeContent,
242+
"maxHeight",
243+
`${this._activeContent.scrollHeight / BASE_FONT_SIZE}em`
244+
)
239245
}
240246
}
241247

src/scss/_config.scss

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ $type-p-line-height: $global-line-height !default;
274274
$type-p-margin-bottom: $global-font-size !default;
275275

276276
$type-code-font: $global-monospace !default;
277-
$type-code-font-size: 1em !default;
277+
$type-code-font-size: $global-font-size !default;
278278
$type-code-color: $gray600 !default;
279279
$type-code-background: lighten($gray900, 10%) !default;
280280
$type-code-border: none !default;
@@ -296,10 +296,10 @@ $type-mark-padding: 0 !default;
296296
$type-mark-color: $gray200 !default;
297297
$type-mark-background: status(warning) !default;
298298

299-
$underline-text-decoration: underline;
299+
$underline-text-decoration: underline !default;
300300

301-
$hr-border: 1px solid $gray900;
302-
$hr-margin: 2.5rem 0;
301+
$hr-border: 1px solid $gray900 !default;
302+
$hr-margin: spacing(4) 0 !default;
303303

304304
$ul-list-style: disc !default;
305305
$ol-list-style: decimal !default;
@@ -615,8 +615,6 @@ $input-border-radius: $form-radius !default;
615615
$input-background: $white !default;
616616
$input-resize: vertical !default;
617617

618-
// Input + Textarea states
619-
620618
$input-hover-background: $input-background !default;
621619
$input-hover-border: $global-border-width solid $gray600 !default;
622620
$input-hover-box-shadow: $input-box-shadow !default;
@@ -666,7 +664,7 @@ $modal-transition-ease: $global-ease !default;
666664
$modal-container-background-color: $white !default;
667665
$modal-container-border-radius: $global-border-radius !default;
668666
$modal-container-padding: $global-space !default;
669-
$modal-container-width: 450px !default;
667+
$modal-container-width: em(450px) !default;
670668
$modal-container-width-small: 95% !default;
671669
$modal-container-margin: 40px auto !default;
672670
$modal-container-margin-small: $global-space auto !default;
@@ -718,7 +716,7 @@ $dropdown-menu-transition: opacity $global-transition !default;
718716
$dropdown-menu-padding: 8px 0 !default;
719717
$dropdown-menu-border-radius: $global-border-radius !default;
720718
$dropdown-menu-background-color: $white !default;
721-
$dropdown-menu-width: 200px !default;
719+
$dropdown-menu-width: em(200px) !default;
722720
$dropdown-menu-border: 1px solid $dropdown-border-color !default;
723721

724722
$dropdown-arrow-offset: 12px !default;
@@ -744,7 +742,7 @@ $tooltip-arrows-enabled: true !default;
744742
$tooltip-padding: 4px 8px !default;
745743
$tooltip-margin: 0 0 $arrow-size !default;
746744

747-
$tooltip-transition: opacity $global-transition !default;
745+
$tooltip-transition: $global-transition !default;
748746

749747
$tooltip-font-size: 14px !default;
750748
$tooltip-border-radius: $global-border-radius !default;

src/scss/components/_tooltip.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
position: absolute;
2222
display: block;
2323
opacity: 0;
24-
transition: $tooltip-transition;
24+
transition: opacity $tooltip-transition;
2525
pointer-events: none;
2626
word-wrap: break-word;
2727
white-space: nowrap;

src/scss/utilities/_functions.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,13 @@
55
@function breakpoint($name) {
66
@return map-get($breakpoints, $name);
77
}
8+
9+
$base-em-font-size: 16px !default;
10+
11+
@function em($pixels, $font-size: $base-em-font-size) {
12+
@return #{$pixels / $font-size}em;
13+
}
14+
15+
@function spacing($increment) {
16+
@return map-get($spacing-increments, "#{$increment}");
17+
}

0 commit comments

Comments
 (0)