Skip to content

Commit 8aa26a9

Browse files
committed
CORE-986: Fix color contrast of signup heading
[CORE-986] New color contrast ratio is 5. Also moved the disabled-submit styling to CSS Also added some JS to control the disabled state of the Continue button on login.
1 parent 31bddde commit 8aa26a9

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

app/assets/javascripts/newflow/newflow_ui.js.coffee

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@ NewflowUi = do () ->
22
disableButton: (selector) ->
33
$(selector).attr('disabled', 'disabled')
44
$(selector).addClass('ui-state-disabled ui-button-disabled')
5-
$(selector).css({
6-
'background': '#ccc',
7-
'box-shadow': 'none',
8-
'color': '#666'
9-
})
105

116
enableButton: (selector) ->
127
$(selector).removeAttr('disabled')

app/assets/stylesheets/newflow.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ $very-narrow: 37rem * $scale-factor;
645645
padding-right: 0;
646646

647647
background-color: #f1f1f1;
648-
color: #c1c1c1;
648+
color: #666666;
649649

650650
@include title-font(2.4rem);
651651
text-align: center;
@@ -745,10 +745,12 @@ $very-narrow: 37rem * $scale-factor;
745745

746746
input[type=submit] {
747747
&:disabled {
748+
background-color: #ccc;
749+
box-shadow: none;
750+
color: #666;
748751
opacity: 0.85;
749752
}
750753

751-
-webkit-appearance: none;
752754
border-radius: 0;
753755
}
754756
}

app/views/newflow/login/login_form.html.erb

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@
9292
<%= f.submit I18n.t(:"login_signup_form.continue_button"),
9393
disable_with: I18n.t(:"login_signup_form.continue_button"),
9494
class: 'primary',
95-
data: { ga_category: 'Login', ga_action: 'Click', ga_label: 'Email' }
95+
data: { ga_category: 'Login', ga_action: 'Click', ga_label: 'Email' },
96+
disabled: 'disabled'
9697
%>
9798
</div>
9899

@@ -117,5 +118,20 @@
117118

118119
<script type="text/javascript">
119120
NewflowUi.focusOnFirstErrorItem();
121+
const form = document.querySelector('form');
122+
const requiredInputs = Array.from(form.querySelectorAll('input[aria-required="true"]'));
123+
const handleDisable = () => {
124+
const disableSubmit = requiredInputs.some((i) => i.value.length == 0);
125+
const submit = form.querySelector('[type="submit"]');
126+
127+
if (disableSubmit) {
128+
submit.setAttribute('disabled', 'disabled');
129+
} else {
130+
submit.removeAttribute('disabled');
131+
}
132+
}
133+
134+
requiredInputs.forEach((i) => i.addEventListener('input', handleDisable));
135+
handleDisable();
120136
</script>
121137

0 commit comments

Comments
 (0)