~alcinnz/rhapsode

256c26c1163cf6c5114e4efb7ce86d61607cbfa7 — Adrian Cochrane 5 years ago 362b4f0
Refine user agent CSS...

* Read <img> alt, failing that src.
* I'll preprocess HTML forms to insert a better labeled link.
* type=button is never meaningful without JS.
* Insert alternatives to audio cues that don't come accross yet.
1 files changed, 10 insertions(+), 14 deletions(-)

M src/DefaultCSS.hs
M src/DefaultCSS.hs => src/DefaultCSS.hs +10 -14
@@ 6,34 6,27 @@ userAgentCSS = unlines [
  "html {speak-as: normal no-punctuation}",
  "",
  "/** Forms **/",
  "/* Hide buttons that don't do anything */",
  "button[type=button] {speak: never}",
  "button[formaction] {speak: always}",
  "button[type=button], input[type=button] {speak: never} /* Won't do anything without JS */",
  "",
  "button::before, input[type=button]::before, input[type=submit]::before {",
  "button::before, input[type=reset]::before, input[type=submit]::before {",
  "        content: 'Button';",
  "        voice-pitch: high;",
  "}",
  "select::before, textarea::before, input::before {content: 'Input'; voice-pitch: high}",
  "output::before {content: 'Output'; voice-pitch: high}",
  "text-area, button, select, input, output {voice-pitch: low}",
  "input, output {content: attr(value)}",
  "input[placeholder] {content: attr(placeholder)}",
  "input[value], output[value] {content: attr(value)}",
  "text-area {speak-as: literal-punctuation}",
  "",
  "option:not([checked]) {speak: never}",
  "select[multiple] option {cue-before: url(bulletpoint.wav)}",
  "",
  "/* Forms themselves require a label in order to support navigation */",
  "form::before {content: 'Form'}",
  "form[action]::before {content: attr(action)}",
  "form[alt]::before {content: attr(alt)}",
  "form[title]::before {content: attr(title)}",
  "",
  "/** Tables **/",
  "table::before {content: 'Table'; voice-volume: x-soft}",
  "tr {cue-before: url(bulletpoint.wav)}",
  "td, th {cue-before: url(bulletpoint.wav) -1db}",
  "th::th /* Rhapsode-specific, selects inlined table headers */ {speak: never;}",
  "tr {cue-before: url(bulletpoint.wav); content: 'row'}",
  "td, th {cue-before: url(bulletpoint.wav) -1db; content: 'cell'}",
  "th > :th /* Rhapsode-specific, selects inlined table headers */ {speak: never;}",
  "table caption {voice-volume: soft}",
  "",
  "/** Sectioning **/",


@@ 54,6 47,8 @@ userAgentCSS = unlines [
  "pre, samp, code {voice: neutral 2}",
  "a[href], :link {cue-before: url(link.wav); voice-pitch: low}",
  ":link:visited {cue-before: url(link.wav) -1db}",
  "img {voice-volume: soft; content: 'Image: ' attr(src)}",
  "img[alt] {content: 'Image: ' attr(alt)}",
  "",
  "b, strong {voice-rate: slow}",
  "i, em {voice-stress: strong}",


@@ 64,6 59,7 @@ userAgentCSS = unlines [
  "",
  "/** lists **/",
  "li, dt, dd {cue-before: url(bulletpoint.wav); pause: strong}",
  "li::before, dt::before, dd::before {content: 'd'} /* Since the cue-before isn't coming accross */",
  "li li, dd dt, dd dd {cue-before: url(bulletpoint.wav) -1db}",
  "li li li, dd dd dt, dd dd dd {cue-before: url(bulletpoint.wav) -2db}",
  "li li li li, dd dd dd dt, dd dd dd dd {cue-before: url(bulletpoint.wav) -3db}",