Skip to content

Commit

Permalink
fix: fix FormLabel sr-only to be more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker committed Oct 8, 2021
1 parent a7cd47f commit 20bb13a
Show file tree
Hide file tree
Showing 14 changed files with 89 additions and 85 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1773,12 +1773,12 @@ button.dnb-button::-moz-focus-inner {
margin-right: 0;
margin-bottom: 0.5rem; }
.dnb-form-label--sr-only {
width: 1px;
margin: 0;
padding: 0;
margin-left: -1px;
overflow: hidden;
white-space: nowrap; }
width: 1px !important;
margin: 0 !important;
padding: 0 !important;
margin-left: -1px !important;
overflow: hidden !important;
white-space: nowrap !important; }
.dnb-form-label[for]:not([disabled]) {
user-select: none;
-webkit-user-select: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,12 +360,12 @@ exports[`Checkbox scss have to match snapshot 1`] = `
margin-right: 0;
margin-bottom: 0.5rem; }
.dnb-form-label--sr-only {
width: 1px;
margin: 0;
padding: 0;
margin-left: -1px;
overflow: hidden;
white-space: nowrap; }
width: 1px !important;
margin: 0 !important;
padding: 0 !important;
margin-left: -1px !important;
overflow: hidden !important;
white-space: nowrap !important; }
.dnb-form-label[for]:not([disabled]) {
user-select: none;
-webkit-user-select: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2113,12 +2113,12 @@ button.dnb-button::-moz-focus-inner {
margin-right: 0;
margin-bottom: 0.5rem; }
.dnb-form-label--sr-only {
width: 1px;
margin: 0;
padding: 0;
margin-left: -1px;
overflow: hidden;
white-space: nowrap; }
width: 1px !important;
margin: 0 !important;
padding: 0 !important;
margin-left: -1px !important;
overflow: hidden !important;
white-space: nowrap !important; }
.dnb-form-label[for]:not([disabled]) {
user-select: none;
-webkit-user-select: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1901,12 +1901,12 @@ button.dnb-button::-moz-focus-inner {
margin-right: 0;
margin-bottom: 0.5rem; }
.dnb-form-label--sr-only {
width: 1px;
margin: 0;
padding: 0;
margin-left: -1px;
overflow: hidden;
white-space: nowrap; }
width: 1px !important;
margin: 0 !important;
padding: 0 !important;
margin-left: -1px !important;
overflow: hidden !important;
white-space: nowrap !important; }
.dnb-form-label[for]:not([disabled]) {
user-select: none;
-webkit-user-select: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ exports[`FormLabel scss have to match snapshot 1`] = `
margin-right: 0;
margin-bottom: 0.5rem; }
.dnb-form-label--sr-only {
width: 1px;
margin: 0;
padding: 0;
margin-left: -1px;
overflow: hidden;
white-space: nowrap; }
width: 1px !important;
margin: 0 !important;
padding: 0 !important;
margin-left: -1px !important;
overflow: hidden !important;
white-space: nowrap !important; }
.dnb-form-label[for]:not([disabled]) {
user-select: none;
-webkit-user-select: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,18 @@
margin-right: 0;
margin-bottom: 0.5rem;
}

&--sr-only {
// could posssibly be 0, but has to be tested if sr still reads the text then
width: 1px;
margin: 0;
padding: 0;
margin-left: -1px; // because of 1px width
overflow: hidden;
white-space: nowrap; // so we don't get a large height because of wrapping in norrow space
// Could possibly be 0, but has to be tested if sr still reads the text then
// We make it custom here, because we need the height,
// therefore we don't use @mixin srOnly()
// also, we want !important here, because project styles, meant to adjust, can suddenly add a margin etc.
width: 1px !important;
margin: 0 !important;
padding: 0 !important;
margin-left: -1px !important; // because of 1px width
overflow: hidden !important;
white-space: nowrap !important; // so we don't get a large height because of wrapping in norrow space
}

// Is not in use
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,12 @@ exports[`FormRow scss have to match snapshot 1`] = `
margin-right: 0;
margin-bottom: 0.5rem; }
.dnb-form-label--sr-only {
width: 1px;
margin: 0;
padding: 0;
margin-left: -1px;
overflow: hidden;
white-space: nowrap; }
width: 1px !important;
margin: 0 !important;
padding: 0 !important;
margin-left: -1px !important;
overflow: hidden !important;
white-space: nowrap !important; }
.dnb-form-label[for]:not([disabled]) {
user-select: none;
-webkit-user-select: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -730,12 +730,12 @@ button.dnb-button::-moz-focus-inner {
margin-right: 0;
margin-bottom: 0.5rem; }
.dnb-form-label--sr-only {
width: 1px;
margin: 0;
padding: 0;
margin-left: -1px;
overflow: hidden;
white-space: nowrap; }
width: 1px !important;
margin: 0 !important;
padding: 0 !important;
margin-left: -1px !important;
overflow: hidden !important;
white-space: nowrap !important; }
.dnb-form-label[for]:not([disabled]) {
user-select: none;
-webkit-user-select: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1455,12 +1455,12 @@ button.dnb-button::-moz-focus-inner {
margin-right: 0;
margin-bottom: 0.5rem; }
.dnb-form-label--sr-only {
width: 1px;
margin: 0;
padding: 0;
margin-left: -1px;
overflow: hidden;
white-space: nowrap; }
width: 1px !important;
margin: 0 !important;
padding: 0 !important;
margin-left: -1px !important;
overflow: hidden !important;
white-space: nowrap !important; }
.dnb-form-label[for]:not([disabled]) {
user-select: none;
-webkit-user-select: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -792,12 +792,12 @@ exports[`Radio scss have to match snapshot 1`] = `
margin-right: 0;
margin-bottom: 0.5rem; }
.dnb-form-label--sr-only {
width: 1px;
margin: 0;
padding: 0;
margin-left: -1px;
overflow: hidden;
white-space: nowrap; }
width: 1px !important;
margin: 0 !important;
padding: 0 !important;
margin-left: -1px !important;
overflow: hidden !important;
white-space: nowrap !important; }
.dnb-form-label[for]:not([disabled]) {
user-select: none;
-webkit-user-select: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1139,12 +1139,12 @@ button.dnb-button::-moz-focus-inner {
margin-right: 0;
margin-bottom: 0.5rem; }
.dnb-form-label--sr-only {
width: 1px;
margin: 0;
padding: 0;
margin-left: -1px;
overflow: hidden;
white-space: nowrap; }
width: 1px !important;
margin: 0 !important;
padding: 0 !important;
margin-left: -1px !important;
overflow: hidden !important;
white-space: nowrap !important; }
.dnb-form-label[for]:not([disabled]) {
user-select: none;
-webkit-user-select: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,12 +433,12 @@ exports[`Switch scss have to match snapshot 1`] = `
margin-right: 0;
margin-bottom: 0.5rem; }
.dnb-form-label--sr-only {
width: 1px;
margin: 0;
padding: 0;
margin-left: -1px;
overflow: hidden;
white-space: nowrap; }
width: 1px !important;
margin: 0 !important;
padding: 0 !important;
margin-left: -1px !important;
overflow: hidden !important;
white-space: nowrap !important; }
.dnb-form-label[for]:not([disabled]) {
user-select: none;
-webkit-user-select: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,12 @@ exports[`Textarea scss have to match snapshot 1`] = `
margin-right: 0;
margin-bottom: 0.5rem; }
.dnb-form-label--sr-only {
width: 1px;
margin: 0;
padding: 0;
margin-left: -1px;
overflow: hidden;
white-space: nowrap; }
width: 1px !important;
margin: 0 !important;
padding: 0 !important;
margin-left: -1px !important;
overflow: hidden !important;
white-space: nowrap !important; }
.dnb-form-label[for]:not([disabled]) {
user-select: none;
-webkit-user-select: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1746,12 +1746,12 @@ exports[`ToggleButton scss have to match snapshot 1`] = `
margin-right: 0;
margin-bottom: 0.5rem; }
.dnb-form-label--sr-only {
width: 1px;
margin: 0;
padding: 0;
margin-left: -1px;
overflow: hidden;
white-space: nowrap; }
width: 1px !important;
margin: 0 !important;
padding: 0 !important;
margin-left: -1px !important;
overflow: hidden !important;
white-space: nowrap !important; }
.dnb-form-label[for]:not([disabled]) {
user-select: none;
-webkit-user-select: none;
Expand Down

0 comments on commit 20bb13a

Please sign in to comment.