gluon-config-mode-theme: add cross-browser styling for <select> elements

Replace the ugly arrow shown in Firefox with a custom SVG arrow. Tested
and working in Firefox, Chrome and Edge. The arrow doesn't show in IE, but
the gluon-web-model JavaScript is already severely broken in IE, so we
don't care.
This commit is contained in:
Matthias Schiffer 2020-07-03 19:01:13 +02:00
parent 5263583b74
commit f75f40d29a
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C
3 changed files with 49 additions and 18 deletions

File diff suppressed because one or more lines are too long

View File

@ -326,6 +326,35 @@ input[type=checkbox] + label {
outline: 0; outline: 0;
} }
.select-wrapper {
position: relative;
display: inline-block;
&::before {
position: absolute;
z-index: 1;
right: 0.05em;
top: calc(2px + 0.1em);
bottom: calc(2px + 0.1em);
width: 1.4em;
border-left: 0.05em solid rgba(0, 0, 0, 0.25);
pointer-events: none;
background:
url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="8" height="5"><path fill="none" stroke="black" stroke-linejoin="bevel" d="M1,1L4,4L7,1"/></svg>')
center / 0.8em 0.5em
no-repeat
;
content: '';
}
select {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
cursor: pointer;
}
}
option { option {
color: darken($ffzusatz, 30); color: darken($ffzusatz, 30);
background: lighten($ffyellow, 30); background: lighten($ffyellow, 30);

View File

@ -4,6 +4,7 @@
%> %>
<% if self.widget == "select" then %> <% if self.widget == "select" then %>
<div class="select-wrapper">
<select data-update="change"<%= <select data-update="change"<%=
attr("id", id) .. attr("id", id) ..
attr("name", id) .. attr("name", id) ..
@ -21,6 +22,7 @@
%>><%|entry.value%></option> %>><%|entry.value%></option>
<%- end %> <%- end %>
</select> </select>
</div>
<% elseif self.widget == "radio" then %> <% elseif self.widget == "radio" then %>
<div> <div>
<% for i, entry in pairs(entries) do %> <% for i, entry in pairs(entries) do %>