Skip to content

Commit d2a7c9b

Browse files
committed
Improve combobox dropdown styling
re: #1389 re: openstreetmap/iD#10127 re: openstreetmap/iD#10144
1 parent 52ac671 commit d2a7c9b

File tree

5 files changed

+49
-28
lines changed

5 files changed

+49
-28
lines changed

css/80_app.css

Lines changed: 43 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,24 +1324,24 @@ a.hide-toggle {
13241324
}
13251325

13261326
/*
1327-
The parts of a field:
1328-
- `.form-field` is a `div` wraps the entire thing
1329-
- `.field-label` is a `label` that wraps the top part, it contains;
1330-
- `span` classed `label-text`
1331-
- 0..n buttons for "remove", "modified", "tag reference"
1332-
- `.form-field-input-wrap` is a `label` or `div` that wraps the bottom part, it contains;
1333-
- usually an `input`
1334-
- sometimes some buttons (translate, increment, decrement)
1335-
- or could just be a `div` with anything really
1336-
- `.tag-reference-body` at the bottom (usually hidden)
1337-
1338-
.------------------. -
1339-
| Name | i | <- .field-label |
1340-
+------------------+ |
1341-
| Starbucks | + | <- .form-field-input-wrap > .form-field
1342-
'------------------' |
1343-
tag reference <- .tag-reference-body |
1344-
-
1327+
The parts of a field:
1328+
- `.form-field` is a `div` wraps the entire thing
1329+
- `.field-label` is a `label` that wraps the top part, it contains;
1330+
- `span` classed `label-text`
1331+
- 0..n buttons for "remove", "modified", "tag reference"
1332+
- `.form-field-input-wrap` is a `label` or `div` that wraps the bottom part, it contains;
1333+
- usually an `input`
1334+
- sometimes some buttons (translate, increment, decrement)
1335+
- or could just be a `div` with anything really
1336+
- `.tag-reference-body` at the bottom (usually hidden)
1337+
1338+
.------------------. -
1339+
| Name | i | <- .field-label |
1340+
+------------------+ |
1341+
| Starbucks | + | <- .form-field-input-wrap > .form-field
1342+
'------------------' |
1343+
tag reference <- .tag-reference-body |
1344+
-
13451345
*/
13461346

13471347
.form-field {
@@ -1517,11 +1517,11 @@ a.hide-toggle {
15171517
display: flex;
15181518
flex-flow: row nowrap;
15191519
}
1520-
.form-field ul.rows li.labeled-input > span,
15211520
.form-field ul.rows li.labeled-input > div {
15221521
flex: 1 1 auto;
15231522
width: 100%;
15241523
border-radius: 0;
1524+
line-height: 0.95rem;
15251525
}
15261526
.form-field ul.rows li input {
15271527
border-radius: 0;
@@ -1540,6 +1540,28 @@ a.hide-toggle {
15401540
border-right-width: 1px;
15411541
}
15421542

1543+
/* Field - lists with labeled input items as table
1544+
------------------------------------------------------- */
1545+
.form-field ul.rows.rows-table {
1546+
display: table;
1547+
width: 100%;
1548+
}
1549+
.form-field ul.rows.rows-table li.labeled-input {
1550+
display: table-row;
1551+
}
1552+
.form-field ul.rows.rows-table li.labeled-input > div:first-child {
1553+
display: table-cell;
1554+
width: auto;
1555+
max-width: 170px;
1556+
white-space: nowrap;
1557+
text-overflow: ellipsis;
1558+
overflow: hidden;
1559+
}
1560+
.form-field ul.rows.rows-table li.labeled-input > div:nth-child(2) {
1561+
display: table-cell;
1562+
width: auto;
1563+
}
1564+
15431565

15441566
/* Field - Structure
15451567
------------------------------------------------------- */
@@ -2166,9 +2188,8 @@ div.combobox {
21662188
display: block;
21672189
padding: 5px 10px;
21682190
border-top: 1px solid #ccc;
2169-
text-overflow: ellipsis;
2170-
white-space: nowrap;
2171-
overflow: hidden;
2191+
line-height: 0.95rem;
2192+
break: all;
21722193
}
21732194

21742195
.combobox a.selected,

modules/ui/fields/access.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function uiFieldAccess(context, uifield) {
3838
.attr('class', d => `labeled-input preset-access-${d}`);
3939

4040
enter
41-
.append('span')
41+
.append('div')
4242
.attr('class', 'label preset-label-access')
4343
.attr('for', d => `preset-input-access-${d}`)
4444
.html(d => uifield.tHtml(`types.${d}`));

modules/ui/fields/cycleway.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function uiFieldCycleway(context, uifield) {
3434

3535
div = div.enter()
3636
.append('ul')
37-
.attr('class', 'rows')
37+
.attr('class', 'rows rows-table')
3838
.merge(div);
3939

4040
var keys = ['cycleway:left', 'cycleway:right'];
@@ -47,7 +47,7 @@ export function uiFieldCycleway(context, uifield) {
4747
.attr('class', function(d) { return 'labeled-input preset-cycleway-' + stripcolon(d); });
4848

4949
enter
50-
.append('span')
50+
.append('div')
5151
.attr('class', 'label preset-label-cycleway')
5252
.attr('for', function(d) { return 'preset-input-cycleway-' + stripcolon(d); })
5353
.html(function(d) { return uifield.tHtml('types.' + d); });

modules/ui/fields/radio.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export function uiFieldRadio(context, uifield) {
126126
.attr('class', 'labeled-input structure-type-item');
127127

128128
typeEnter
129-
.append('span')
129+
.append('div')
130130
.attr('class', 'label structure-label-type')
131131
.attr('for', 'preset-input-' + selected)
132132
.html(l10n.tHtml('inspector.radio.structure.type'));
@@ -171,7 +171,7 @@ export function uiFieldRadio(context, uifield) {
171171
.attr('class', 'labeled-input structure-layer-item');
172172

173173
layerEnter
174-
.append('span')
174+
.append('div')
175175
.attr('class', 'label structure-label-layer')
176176
.attr('for', 'preset-input-layer')
177177
.html(l10n.tHtml('inspector.radio.structure.layer'));

modules/ui/fields/wikidata.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export function uiFieldWikidata(context, uifield) {
106106
.attr('class', function(d) { return 'labeled-input preset-wikidata-' + d; });
107107

108108
enter
109-
.append('span')
109+
.append('div')
110110
.attr('class', 'label')
111111
.html(function(d) { return l10n.tHtml('wikidata.' + d); });
112112

0 commit comments

Comments
 (0)