Skip to content

Commit 80828bd

Browse files
committed
app: Give placeholder text sufficient contrast
* Override user-agent styling for placeholder text to ensure it has sufficient contrast. #757575 has a contrast ratio of 4.6:1. * Use 'form-select' class on all <SELECT/> elements. Bootstrap's styling ensures a white background instead of the Mac gradient used by some user agents on the Mac OS. The gradient would have lowered the ratio to 3.76:1. * Remove duplicated CSS rules from application.scss for maintainability. Closes: ADA-397
1 parent f0a8668 commit 80828bd

6 files changed

Lines changed: 12 additions & 76 deletions

File tree

app/assets/stylesheets/application.scss

Lines changed: 4 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ a:hover, a:active, a:focus {
5454
border-color: lightgrey;
5555
}
5656

57-
5857
.table-header {
5958
background-color: #e5e7e9;
6059
color: #3b3b3b;
@@ -80,6 +79,10 @@ input[type="text"], input[type="date"], input[type="time"], select {
8079
box-sizing: border-box;
8180
}
8281

82+
input::placeholder, select::placeholder {
83+
color: #757575;
84+
}
85+
8386
input[type="text"], select {
8487
width: 100%;
8588
}
@@ -108,18 +111,6 @@ label {
108111
padding: 8px;
109112
}
110113

111-
.btn-danger,
112-
.btn-primary,
113-
.btn-secondary {
114-
box-shadow: none !important;
115-
color: white !important;
116-
}
117-
118-
.btn-link:hover {
119-
text-decoration: none;
120-
}
121-
122-
123114
.desc {
124115
max-width: 100px;
125116
}
@@ -217,61 +208,6 @@ label {
217208
}
218209
}
219210

220-
.form-group.required label:after {
221-
content: "*";
222-
color: #ee0000;
223-
margin-left: 0.25rem;
224-
}
225-
226-
a, a:link, a:visited {
227-
box-shadow: inset 0 -4px 0 #FDB515;
228-
transition: background 0.25s ease-in-out, color 0.25s ease-in-out;
229-
text-decoration: none;
230-
color: black;
231-
232-
&.no-link-style {
233-
box-shadow: none;
234-
}
235-
236-
li & {
237-
box-shadow: inset 0 -2px 0 #FDB515;
238-
239-
.navbar-nav & {
240-
box-shadow: none;
241-
}
242-
}
243-
}
244-
245-
a:hover, a:active, a:focus {
246-
background: #FDB515;
247-
248-
&.no-link-style {
249-
background: none;
250-
}
251-
}
252-
253-
.tblheader {
254-
font-weight: bold;
255-
color: blue;
256-
}
257-
258-
// Some of the styles above were butchering Bootstrap buttons in tables
259-
.btn-danger,
260-
.btn-primary,
261-
.btn-secondary {
262-
box-shadow: none !important;
263-
color: white !important;
264-
}
265-
266-
.btn-link:hover {
267-
text-decoration: none;
268-
}
269-
270-
.btn.btn-primary:disabled {
271-
background-color: lightgrey;
272-
border-color: lightgrey;
273-
}
274-
275211
.page {
276212
padding-left: 2px;
277213
padding-right: 2px;

app/views/forms/insert_form.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<%= form_with(url: items_path, local: true, multipart: true) do |form| %>
88
<div class="form-group required">
99
<%= form.label(:item_type, 'Item type:') %>
10-
<%= form.select(:item_type, options_for_select(@item_type_layout), { prompt: 'Select a type' }, { required: true }) %>
10+
<%= form.select(:item_type, options_for_select(@item_type_layout), { prompt: 'Select a type' }, { required: true, class: 'form-select' }) %>
1111
</div>
1212

1313
<div class="form-group required">
@@ -37,7 +37,7 @@
3737

3838
<div class="form-group required">
3939
<%= form.label(:location, 'Held at location:') %>
40-
<%= form.select(:location, options_for_select(@locations_layout), { prompt: 'Select a location' }, { required: true }) %>
40+
<%= form.select(:location, options_for_select(@locations_layout), { prompt: 'Select a location' }, { required: true, class: 'form-select' }) %>
4141
</div>
4242

4343
<div style="padding-top: 8px; padding-bottom: 8px;">

app/views/forms/search_form.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010

1111
<div>
1212
<%= form.label(:item_type, 'Item type:') %>
13-
<%= form.select(:item_type, item_type_options, include_blank: true) %>
13+
<%= form.select(:item_type, item_type_options, { include_blank: true }, { class: 'form-select' }) %>
1414
</div>
1515
<div>
1616
<%= form.label(:keyword, 'Keywords:') %>
1717
<%= form.text_field :keyword, placeholder: 'Enter search terms separated by spaces' %>
1818
</div>
1919
<div>
2020
<%= form.label(:location, 'Location:') %>
21-
<%= form.select(:location, location_options, include_blank: true) %>
21+
<%= form.select(:location, location_options, { include_blank: true }, { class: 'form-select' }) %>
2222
</div>
2323

2424
<fieldset>

app/views/home/admin_users.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<%= form_with(url: user_insert_path, local: true) do |form| %>
77

88
<%= form.label(:user_role, 'User role:') %> <span style="color: #ee0000"> * </span>
9-
<%= form.select(:user_role, options_for_select(User::ROLES), include_blank: true, required: true) %>
9+
<%= form.select(:user_role, options_for_select(User::ROLES), { include_blank: true }, { required: true, class: 'form-select' }) %>
1010

1111
<%= form.label(:user_name, 'User name:') %><span style="color: #ee0000"> * </span>
1212
<%= form.text_field :user_name, placeholder: 'John Smith', required: true %>

app/views/items/edit.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<%= form.hidden_field(:id, value: @item.id) %> <%# TODO: just do this the Rails way %>
88
<div class="form-group required">
99
<%= form.label(:item_type, 'Item type:') %>
10-
<%= form.select(:item_type, options_for_select(@item_type_layout, @item.item_type), {}, { required: true }) %>
10+
<%= form.select(:item_type, options_for_select(@item_type_layout, @item.item_type), {}, { required: true, class: 'form-select' }) %>
1111
</div>
1212

1313
<div class="form-group required">
@@ -38,7 +38,7 @@
3838

3939
<div class="form-group required">
4040
<%= form.label(:location, 'Held at location:') %>
41-
<%= form.select(:location, options_for_select(@locations_layout, @item.location), {}, { required: true }) %>
41+
<%= form.select(:location, options_for_select(@locations_layout, @item.location), {}, { required: true, class: 'form-select' }) %>
4242
</div>
4343

4444
<div style="padding-top: 8px; padding-bottom: 8px;">

app/views/users/edit.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<%= form_with(url: user_path, method: :put, local: true) do |form| %>
44

55
<%= form.label(:user_role, "User role:") %>
6-
<%= form.select(:user_role, options_for_select(User::ROLES, @user.user_role)) %>
6+
<%= form.select(:user_role, options_for_select(User::ROLES, @user.user_role), {}, { class: 'form-select' }) %>
77

88
<%= form.label(:user_name, "User name:") %>
99
<%= form.text_field :user_name, value: @user.user_name %>

0 commit comments

Comments
 (0)