aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2025-01-15 22:08:28 +0100
committerbptato <nincsnevem662@gmail.com>2025-01-15 22:08:28 +0100
commitf2b7e4e9f148e32fad7c4945c8264b58da1f0858 (patch)
treed12e235dc2e283b36feb347f5e98b58889804d4d
parentebdf6ba3641c67ab22e0de0c8851ac97fb0ea75b (diff)
downloadchawan-f2b7e4e9f148e32fad7c4945c8264b58da1f0858.tar.gz
ua.css: fix select multiple rendering
-rw-r--r--res/ua.css18
-rw-r--r--test/layout/select-multiple.expected6
-rw-r--r--test/layout/select-multiple.html12
3 files changed, 31 insertions, 5 deletions
diff --git a/res/ua.css b/res/ua.css
index ec74324d..04fd891c 100644
--- a/res/ua.css
+++ b/res/ua.css
@@ -132,20 +132,28 @@ dd { margin-left: 4ch }
dl[compact] dt + br { display: none }
select { display: inline-flex !important; white-space: nowrap }
-select[multiple] { white-space: initial }
select::before { content: '['; color: initial }
select::after { content: ']'; color: initial }
select > :is(option, optgroup > option) { display: none }
select > :is(option, optgroup > option):checked { display: block; color: red }
-select[multiple] { display: inline-block; overflow: auto }
+select[multiple] {
+ overflow: auto;
+ display: flow-root !important;
+ margin-top: 1em
+}
select[multiple]::before, select[multiple]::after { content: '' }
select[multiple] > :is(option, optgroup > option) {
- display: flex; color: inherit
+ display: flex;
+ color: initial
+}
+select[multiple] > :is(option, optgroup > option)::before {
+ display: block;
+ content: '[ ]'
}
-select[multiple] > :is(option, optgroup > option)::before { content: '[ ]' }
select[multiple] > :is(option, optgroup > option):checked::before {
- content: '[*]'; color: red
+ content: '[*]';
+ color: red
}
center { text-align: -cha-center }
diff --git a/test/layout/select-multiple.expected b/test/layout/select-multiple.expected
new file mode 100644
index 00000000..388c6ee8
--- /dev/null
+++ b/test/layout/select-multiple.expected
@@ -0,0 +1,6 @@
+
+[ ]test test test test test test test test test
+[ ]test
+[ ]test
+[ ]test
+test
diff --git a/test/layout/select-multiple.html b/test/layout/select-multiple.html
new file mode 100644
index 00000000..39097020
--- /dev/null
+++ b/test/layout/select-multiple.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<select multiple>
+<option>test test test test test test test test test</option>
+<option>test</option>
+<option>test</option>
+<option>test</option>
+</select>
+
+<!-- Note: mainstream browsers tend to put this next to the select.
+ However, w3m puts it after the select (i.e. treats it as block),
+ and so do we.-->
+test