Add QR-code to all popups, add direction indicator to popup and visual feedback, make reviews accessible to screenreaders (both to read them and to make them)

This commit is contained in:
Pieter Vander Vennet 2023-12-24 05:01:10 +01:00
parent 5567869bb4
commit bfd818cb38
33 changed files with 415 additions and 98 deletions

View file

@ -57,7 +57,11 @@
validator = Validators.get(type ?? "string")
_placeholder = placeholder ?? validator?.getPlaceholder() ?? type
feedback?.setData(validator?.getFeedback(_value.data, getCountry))
if(_value.data?.length > 0){
feedback?.setData(validator?.getFeedback(_value.data, getCountry))
}else{
feedback?.setData(undefined)
}
initValueAndDenom()
}
@ -65,9 +69,14 @@
function setValues() {
// Update the value stores
const v = _value.data
if (!validator?.isValid(v, getCountry) || v === "") {
if(v === ""){
value.setData(undefined)
feedback.setData(undefined)
return
}
if (!validator?.isValid(v, getCountry)) {
feedback?.setData(validator?.getFeedback(v, getCountry))
value.setData("")
value.setData(undefined)
return
}

View file

@ -16,15 +16,22 @@ export default class NatValidator extends IntValidator {
return str.indexOf(".") < 0 && !isNaN(Number(str)) && Number(str) >= 0
}
/**
*
* const validator = new NatValidator()
* validator.getFeedback(-4).textFor("en") // => "This number should be positive"
*/
getFeedback(s: string): Translation {
console.log("Getting feedback for", s)
const n = Number(s)
if (!isNaN(n) && n < 0) {
return Translations.t.validation.nat.mustBePositive
}
const spr = super.getFeedback(s)
if (spr !== undefined) {
return spr
}
const n = Number(s)
if (n < 0) {
return Translations.t.validation.nat.mustBePositive
}
return undefined
}
}